Field fine tuning problems
I have a field or two that has a few house cleaning chores to do in order to increase functionality and eliminate some confusion for the user but I have gone about as far as I can with it.
First, I have a Yes/No radio group that will conditionally show a date field. This part works for all intents and purposes, but.....
If No is selected the datefield is not visible, if yes is selected the date field is visible.
If the user selects 'yes' and fills in the datefield and then proceeds to the next page and then hits the back button the 'Yes' is still selected but the date field with their date entered is not visible, but if the radio button is re-selected the field will become visible with the date that they entered. How do I make it so that no matter what that if the 'Yes' option is selected the datefield will be visible?
Heres my current code at the moment:
<script type = "text/javascript">
<!--
function hide(x) {
document.getElementById(x).style.visibility="hidden";
}
function show(x) {
document.getElementById(x).style.visibility="visible";
}
//-->
</script>
<cfinput type="radio" id="sendbcastemail2" name="sendbcastemail" onClick="hide('showhidesendbcastemail')" value="No" checked="#sendbcastemail2_Checked#">No
<cfinput type="radio" id="sendbcastemail1" name="sendbcastemail" onClick="show('showhidesendbcastemail')" value="Yes" checked="#sendbcastemail1_Checked#">Yes
<cfdiv id="showhidesendbcastemail" style="visibility:#showhidesendbcastemaildate#">Select date:<br>
<cfinput type="datefield" name="sendbcastemaildate" value="#getLastedit.sendbcastemaildate#" validate="date" message="Enter a Valid Date">
Next, how do I make the datefield conditionally required.
If the user selects 'No' the field is not required, but if 'Yes' is selected the datefield is required?
TIA for any assistance.
