如果勾选方框,如何使字段成为必填字段。 [英] How can I make a field become mandatory if a box is ticked.

查看:119
本文介绍了如果勾选方框,如何使字段成为必填字段。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个用户点名表单,用户填写表格让IT知道他们需要在'''''系统上进行设置。当用户在我想要电子邮件复选框中放置一个十字架时,我希望该表单能够使另外两个文本字段变为必填项。如果他们不要求电子邮件(这是一种侮辱),那么这些盒子就不是强制性的。


提前谢谢.....

Hi

I have a user enolment form which is users fill out to let IT know that they need setting up on ''x'' systems. When the user put a cross in the ''I would like Email'' checkbox I would like the form to make two other text field become mandatory. If they dont request email (which is the defult) the boxes will not be mandatory.

Thanks in advance.....

推荐答案

显示表单HTML标记。


您需要检查checkbox对象的checked属性。如果已选中,请检查两个现在必填字段是否包含其中的内容,方法是检查它们的值。如果他们没有,请提示错误信息。
Show the form HTML markup.

You will need to check for the checked property of the checkbox object. If it''s checked, check that the two now mandatory fields have something in them by checking their values. If they don''t, alert an error message.


大家好


这可能是一个简单的请求,显示了我的新手级别专业知识..


我有一个简单的html表格。

表格上有一个方框,要求用户提供电子邮件地址。这个字段不是强制性的......

但是如果用户点击发送给我一封电子邮件的复选框,那么我想要一个脚本来运行,这将使电子邮件地址字段成为可能成为强制性..

它必须是一个简单的 - 如果'''X''被勾选为''Y''强制性的"但我无法弄清楚...


提前谢谢...
Hi all

This is probably a simple request which shows my level of novice of expertise in this..

I have a simple html form.
There is a box on the form which asks for the users Email address. This field is not mandatory...
BUT if a user clicks a Check Box which says ''Send me an email'' then I would like a script to run which would the make the Email address field become mandatory..
It''s got to be a simple - "if ''X'' is ticked make ''Y'' mandatory" but i cant figure it out...

Thanks in advance...


合并的主题。请不要双重帖子

这篇关于如果勾选方框,如何使字段成为必填字段。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆