3 Replies Latest reply on Nov 26, 2008 6:41 PM by Newsgroup_User

    enable disable control

    rmorgan Level 1
      I am trying to enable or disable an cfinput type of datefield and having problems getting it to work with what I am doing. I have a simple radiogroup with yes or no as the option. If yes is selected the datefield is enabled and/or visible and if no is selected the datefield is disabled and/or invisible.

      My code:
      <cfinput type="radio" name="listoncalendar" value="Yes" onclick="document.form.listoncalendardate.visible = true" >
      <cfinput type="radio" name="listoncalendar" value="No" onclick="document.form.listoncalendardate.visible = false">
      <cfinput type="datefield" name="listoncalendardate">

      Where am I going wrong?
        • 1. Re: enable disable control
          Dan Bracuk Level 5
          This is a guess. Cold Fusion datefields are flash movies and don't respond to javascript commands.

          If that's the case, put your datefield inside a div or span tag and make that visible/hidden. If you still get a value when it's hidden, deal with it on the results page.
          • 2. Re: enable disable control
            rmorgan Level 1
            Ok, I see in where cfinput type=datefield was only for flash forms but now according to the docs CF8 supports support cfinput type=datefield in html. This excerpt is from cf8 livedocs, does what you suggested still apply with what the history changes are stated to be?

            History
            ColdFusion 8

            * Added autosuggest, autosuggestBindDelay, autosuggestMinLength, delimiter, maxResultsDisplayed, showAutosuggestLoadingIcon, and typeahead attributes.
            * Added support for the bind attribute in HTML forms and the bindAttribute and bindOnload, and onBindError attributes.
            * Added the sourceForTooltip attribute
            * Added support for datefield value of the type attribute in HTML forms.
            • 3. Re: enable disable control
              Level 7
              document.form.listoncalendardate.visible is not a valid js code.
              you need to use
              document.form.listoncalendardate.style.visibility="hidden", and that is
              if your FORM tag has NAME="form" attribute. otherwise use the FORM's
              NAME instead of 'form'.

              Azadi Saryev
              Sabai-dee.com
              http://www.sabai-dee.com/