Skip to main content
Participating Frequently
January 18, 2013
Question

Hide datefield coldfusion control using JavaScript

  • January 18, 2013
  • 1 reply
  • 638 views

I have a straight forward datefield control.  Looks like the following:

<cfinput type="dateField" name="dt_RtDate" width="60px"  id="dt_RtDate" title="Enter or select repeat date" value=""  >

Now I have a javascript function that happens on a click event that I use to want to hide this control it looks similar to the following:

//Hide Repeater control

    var dtRepeater =  document.getElementById('dt_RtDate'); 

    dtRepeater.style.visibility = "hidden";

this works fine, but there is a problem I notice.  The textbox dissapears and this is fine, but the calendar image control IS STILL VISIBLE?!

So my question is I am not sure how to reference this control or property to make the entire thing go away.  I would also then like to know the flipside of showing it too (which I am using by saying ...  dtRepeater.style.visibility = "";   )

So what do I have to do to reference the coldfusion date control to make it dissapear completely?

Thanks,

    This topic has been closed for replies.

    1 reply

    Inspiring
    January 18, 2013

    You could always put it inside a span or div and do your show/hide on that element.

    Participating Frequently
    January 18, 2013

    yup that makes sense did that instead thanks.