?
Solved

form Validation in CF 7

Posted on 2009-04-10
1
Medium Priority
?
253 Views
Last Modified: 2013-12-24
Hi, i am currently having problem with some validation. i have two radio buttons, as Yes and NO. if user selects yes, then it enables a panel to provide more information from user. and those fields are required in the form. but if they select No, then it should let them pass the required fields.

right now, when i select no it still asks me for those required fields.
 how can i bypass that. is there any way?

<cfformgroup type="panel" label="Research Mentor Information">
				<cfformitem type="text" style="">Are you currently working with a mentor(s), or do you have an anticipated mentor(s)?</cfformitem>
				
				<cfif qGetData.Mentor IS 1>
					<cfinput type="radio" name="Mentor" label="Yes" value="1" onclick="mentors.enabled=true;" checked="true">
				<cfelse>
					<cfinput type="radio" name="Mentor" label="Yes" value="1" onclick="mentors.enabled=true;" checked="false" required="true" message="You must select 'YES' or 'NO">
				</cfif>
				<cfif qGetData.Mentor IS 0>
					<cfinput type="radio" name="Mentor" label="No" value="0" onclick="mentors.enabled=false;" checked="true">
				<cfelse>
					<cfinput type="radio" name="Mentor" label="No" value="0" onclick="mentors.enabled=false;" checked="false" required="true" message="You must select 'YES' or 'NO">
				</cfif>
				<cfformgroup type="horizontal" label="" id="mentors" enabled="false" visible="true">
					<cfformgroup type="hdividedbox">
						<cfinput type="text" name="MentorName1" label="Name *" width="200" value="#qGetData.MentorName1#"  required="true">
						<cfinput type="text" name="MentorInstitution1" label="Institution *" width="200" value="#qGetData.MentorInstitution1#" required="true">
						<cfinput type="text" name="MentorDepartment1" label="Department *" width="200" value="#qGetData.MentorDepartment1#" required="true">
						<cfinput type="text" name="MentorDivision1" label="Division" width="200" value="#qGetData.MentorDivision1#">
					</cfformgroup>
					<cfformgroup type="hdividedbox">
						<cfinput type="text" name="MentorName2" label="Name" width="200" value="#qGetData.MentorName2#">
						<cfinput type="text" name="MentorInstitution2" label="Institution" width="200" value="#qGetData.MentorInstitution2#">
						<cfinput type="text" name="MentorDepartment2" label="Department" width="200" value="#qGetData.MentorDepartment2#"> 
						<cfinput type="text" name="MentorDivision2" label="Division" width="200" value="#qGetData.MentorDivision2#">
					</cfformgroup>
					<cfformgroup type="hdividedbox">
						<cfinput type="text" name="MentorName3" label="Name" width="200" value="#qGetData.MentorName3#">
						<cfinput type="text" name="MentorInstitution3" label="Institution" width="200" value="#qGetData.MentorInstitution3#">
						<cfinput type="text" name="MentorDepartment3" label="Department" width="200" value="#qGetData.MentorDepartment3#">
						<cfinput type="text" name="MentorDivision3" label="Division" width="200"value="#qGetData.MentorDivision3#">
					</cfformgroup>
				</cfformgroup>
			</cfformgroup>
		<!--- END OF RESEARCH MENTORS INFO --->
		<cfformgroup type="horizontal" style="horizontalAlign:center">
			<cfinput type="hidden" name="sect" value="2">
			<cfinput type="submit" name="save" value="Save">
			<!--- <cfinput type="reset" name="reset" value="Reset"> --->
		</cfformgroup>

Open in new window

0
Comment
Question by:khan02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
duncancumming earned 1500 total points
ID: 24117707
I don't think the required attribute works with the input type="radio".  Instead you'll need to use javascript or server-side validation to ensure user picks a value.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question