Copy link to clipboard
Copied
Hi,
when i click on the radio button, the text box for fname is showed. If i don't enter anything into text box then hit submit, the pop up will display with code for validate below. When i hit OK to go back,
the text box is gone but the radio button still checked. How can i keep the text box stays on the page?
<!---form.cfm--->
<cfform name="myform" action="action.cfm">
<cfinput type="radio" name="approve" value="1" onclick="show('d0','d1')" />
<div id="d0">
<cfinput type="text" name="fname">
</div>
<cfinput type="submit" name="submit" value="Add">
</cfform>
<!---action.cfm--->
<cfif isDefined("form.submit")>
<cfif Not Len(Trim(form.fname))>
<script type="text/javascript">
alert("Name can not be blank.");
history.back(-1);
</script>
<cfabort>
</cfif>
</cfif>
Thanks
KT
Copy link to clipboard
Copied
Write JavaScript that will check the status of the radio button upon form.cfm load, then show/hide accordingly.
^_^
Copy link to clipboard
Copied
i am not good at this, can you please provide any example?