简体   繁体   English

在页面重定向到联系表之前,如何对单选按钮进行验证

[英]How to give validation to radio buttons before page redirect to contact form

i have developed a survey form with the help of html and css. 我借助html和css开发了调查表。 I want to give validation to question before page redirect to Contact form. 我想在页面重定向到“联系表”之前对问题进行验证。 In Survey form when user click in submit button page will redirect to contact form. 在“调查”表单中,当用户单击“提交”按钮页面时,将重定向到联系表单。 but i want to put validation so that user has to click on all question before page redirect to contact form. 但是我想进行验证,以便用户必须在页面重定向到联系表之前单击所有问题。

I don't have the privalage to comment but you can use the required field as follows 我没有发表评论的特权,但您可以按如下所示使用必填字段

 <input type="radio" name="question-1-answers" id="question-1-answers-A" value="A" required=true />

using this way the user will have to click all the required fields before submitting a form. 使用这种方式,用户必须在提交表单之前单击所有必填字段。

To make sure all fields are filled before submission of the form: 为了确保在提交表单之前填写所有字段:

<input type="radio" required>

The ' required ' attribute makes sure all fields are filled before the form can be submitted. “ required”属性可确保在提交表单之前填写所有字段。

You just need to set the required-attribute for one input of the radiogroup, but you can set it for all. 您只需要为单选组的一个输入设置必填属性,但您可以为所有设置。 use the required field validator or refer the link below http://www.chennaisunday.com/jsradio.html 使用所需的字段验证器或参考下面的链接http://www.chennaisunday.com/jsradio.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM