Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping buttons "greyed out" and text displayed after form submitted

Status
Not open for further replies.

gns100

Programmer
Aug 11, 2003
40
US
In the form below I'm trying to use the preservedata="Yes" option in order to keep the form data in the same manner after it's been submitted.

If the Mexico or San_Diego option is selected from the drop-down list, then only the "Week" button can be used.

After the form is submitted it preserves the radio button selection but I want it also to keep the other two buttons "greyed out" and keep the red text message displayed.

Any help would be appreciated. Thanks.

Code:
<cfparam name="tperiod" default="week">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>
<cfform action="foo_1.cfm" name="foo_1" preservedata="Yes" onSubmit="radioCheck()">
  <cfselect size="1" name="vacation" onChange='radioCheck()'>
  <option value="entry">Vacation List</option>
  <option value="">---------</option>
  <option value="haw">Hawaii</option>
  <option value="mex">Mexico</option>
  <option value="sd">San_Diego</option>
  </cfselect>
	<br>
	<br>
	<cfinput name="tperiod" type="radio" value="month">Month
	<cfinput name="tperiod" type="radio" value="week" checked>Week
	<cfinput type="radio" name="tperiod" value="day">Day
	
	<b><font face="Times Roman" color="red" size="2">&nbsp;&nbsp;&nbsp;&nbsp;<span id = "ministryText"></span></font></b>
	<br>
	<br>
	<input type="submit" value="submit">
</cfform>

<script javaScript>
function radioCheck(){
var obj = foo_1.vacation;

	if( obj.options(obj.selectedIndex).value == "mex" ||
		obj.options(obj.selectedIndex).value == "sd" 
	){
		foo_1.tperiod[2].disabled = true;
		foo_1.tperiod[0].disabled = true;
		foo_1.tperiod[1].disabled = false;
		foo_1.tperiod[1].checked = true;

		document.partnerText='Only "Week" is available.';
		document.getElementById("ministryText").innerHTML = document.partnerText;
	}
	else{
		foo_1.tperiod[2].disabled = false;
		foo_1.tperiod[0].disabled = false;
		foo_1.tperiod[1].disabled = false;
		
		document.partnerText='';
		document.getElementById("ministryText").innerHTML = document.partnerText;
	}
}
</script>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top