2 Replies Latest reply on May 21, 2013 8:45 AM by newcf

    show and hide with radio button

    newcf Level 1

      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