Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

HELP!! How do I verify state of a text box when using radio buttons?

Posted on 2009-02-18
5
Medium Priority
?
178 Views
Last Modified: 2012-05-06
I have 3 text boxes that are coded so that in order to move forward on this form, SOMETHING needs to be input otherwise it won't proceed. I wanted to add 2 radio buttons that will disable each textbox when chosen OR disable the radio buttons when text is entered.
<a name="remoteExam"></a>
		<h2>Remote Physicial Examination</h2>
		<% If objConRemoteExam.Found AND (IsNumeric(objConRemoteExam.BPSys) AND IsNumeric(objConRemoteExam.BPDia)) Then 
				If ((objConRemoteExam.BPSys > 185) OR (objConRemoteExam.BPDia > 110)) Then %>
					<p><strong>Blood pressure should be SBP less than 180 and DBP less than 110 to give IV tPA; if it cannot be reduced despite basic measures to lower it acutely (see treatment recommendations below), then IV tPA should not be given.</strong></p>
				<% End If %>
		<% End If %>
		<input type="hidden" name="section" value="RemoteExam" />
		<table class="formSection">
			<tr>
				<td width="446" <% If pblnValidate AND NOT(.IsBpValid()) Then Response.Write "class='warning'"%>>
				
			  <label for="txtBPSys">BP *</label></td>
			  <td width="187"><input size="3" type="text" id="txtBPSys" name="txtBPSys" maxlength="3" value="<%=.BPSys%>" /> / 
					<input size="3" type="text" id="txtBPDia" name="txtBPDia" maxlength="3" value="<%=.BPDia%>" />
					<form id="form2" name="form2" method="post" action="">
					  <label>
					    <input name="radiobutton" type="radio" value="radiobutton" />
					    ND</label>
			    </form></td>
			</tr>
			<tr>
				<td <% If pblnValidate AND NOT(.IsPulseValid()) Then Response.Write "class='warning'"%>>
				<label for="txtPulse">Pulse *</label></td>
			  <td><input type="text" id="txtPulse" name="txtPulse" value="<%=.Pulse%>" maxlength="5" />
				  <form id="form1" name="form1" method="post" action="">
				    <label>
				      <input name="radiobutton" type="radio" value="radiobutton" />
				      ND</label>
			    </form>			    </td>
			</tr>
			<tr>
				<td class="lbl">Evidence of acute aortic dissection, MI, hypoglycemia, or end stage malignancy *</td>
				<td class="val"><%=createRadioButtons(aryBln, aryYesNo, "blnEvidenceAAD", convertBoolToBit(.EvidenceAAD), "&nbsp;&nbsp;&nbsp;", "")%></td>
			</tr>
		</table>

Open in new window

0
Comment
Question by:Bulldog7
  • 3
  • 2
5 Comments
 

Author Comment

by:Bulldog7
ID: 23674971
Thx for any suggestions...was thrown onto a project when someone abruptly left and not 100% confident with the code, I'm better doing edits to be honest.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 23677464
Hi Bulldog7,

You may want to look into the wforms javascript library and use the conditional fields scripting to validate that form.  You can use that library to make form elements trigger show/hide behavior in other form elements as well as perform basic validation.  If a form element is hidden, the library does not submit it with the form and that should take care of this issue.
0
 

Author Comment

by:Bulldog7
ID: 23681725
Thank you Jason, although I'm confused as to where I actually place the wforms.js file itself, I know you have to include it in the header....
Here is what I've currently tried although the second text box won't respond like the first 2 above it, and ultimately I'd rather the radio buttons toggle on/off and the text box states do the same...
 <label for="txtBPSys">BP *</label></td>
			  <td width="187"><input size="3" type="text" id="txtBPSys" name="txtBPSys" maxlength="3" value="<%=.BPSys%>" /> / 
					<input size="3" type="text" id="txtBPDia" name="txtBPDia" maxlength="3" value="<%=.BPDia%>" />
					<form id="form2" name="form2" method="post" action="">
					  <label>
					    <input type="radio" name="A" value="A" onclick="if(this.checked){this.form.txtBPSys.disabled=true;this.form.txtBPDia.disabled=true}" />
					    ND:<br /><br />
				      </label>
			    </form></td>
			</tr>
			<tr>
				<td <% If pblnValidate AND NOT(.IsPulseValid()) Then Response.Write "class='warning'"%>>
				<label for="txtPulse">Pulse *</label></td>
			  <td><input type="text" id="txtPulse" name="txtPulse" value="<%=.Pulse%>" maxlength="5" />
			    <input name="B" value="B" type="radio" onclick=
				"if(this.checked){this.form.txtPulse.disabled=true}"  />
			  ND:<br /><br />
				      </label>
		  	    </td>
			</tr>

Open in new window

0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 1500 total points
ID: 23689182
>> I'm confused as to where I actually place the wforms.js file itself,

Place the call to the script inside of the <head></head> tags.  Place the file itself anywhere you want in the web site.  However, it looks like you are not going to try that solution, right?
0
 

Author Closing Comment

by:Bulldog7
ID: 31548348
Thank you Jason! Although I didn't use it here I am definitely gonna use it in other parts!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

578 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