Skip to main content
Inspiring
November 25, 2008
Question

enable disable control

  • November 25, 2008
  • 2 replies
  • 558 views
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?
This topic has been closed for replies.

2 replies

Inspiring
November 27, 2008
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/
Inspiring
November 25, 2008
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.
rmorganAuthor
Inspiring
November 25, 2008
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.