• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

show and hide with radio button

New Here ,
May 21, 2013 May 21, 2013

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

Views

487

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

Write JavaScript that will check the status of the radio button upon form.cfm load, then show/hide accordingly.

^_^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

LATEST

i am not good at this, can you please provide any example?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation