Skip to main content
Inspiring
October 24, 2010
Question

CFwindow validation on Checkbox

  • October 24, 2010
  • 1 reply
  • 607 views

I am trying to validate records based on the onclick event of a Checkbox or change event of a select option, for some reason this is not working in a cfwindow.

This is my form. can some please tell me what I did wrong here. The javascript is not even being called in a CFWINDOW.

<input type="checkbox" name="ccSameddress" value="shipsame" onclick="return sameinfo();">and below is my script:

<script language="JavaScript">
function sameinfo()
{
var d = document.cbfoundation;       
    if (d.chkSameddress.checked==true)
    {
        d.shipFName.value=d.bccFname.value;       
        d.shipLName.value=d.bccLname.value;       
        d.shipAddr1.value=d.bccAddr.value;   
    }
    if (d.chkSameddress.checked==false){
        d.shipFName.disabled=false;
        d.shipLName.disabled=false;
        d.shipAddr1.disabled=false;       
    }   
}
</script>

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 24, 2010

    Troubleshooting js is tedious.  The way I do it is by using window.alerts to show the value of the variables that matter.  Also, before concluding that the javascript is not being called at all, I suggest

    window.alert("blah");

    as the first line of your function.  Then you'll know if the function was called.

    It may or may not matter, but I always have return statements in my functions.

    umuayoAuthor
    Inspiring
    October 24, 2010

    Dan,

    It works as a stand alone page. but when the form is called as a CFWINDOW it does not work. Was just wondering if some one has experienced this before and how they were able to solve the problem.

    umuayoAuthor
    Inspiring
    October 24, 2010

    Problem solved.

    I had to create a blank page and called the CFWINDOW page as an IFRAME, and now the validation is workinng.

    There has to be a bug with the way CFWINDOW handles some events. I also noticed you can not upload a file in CFWINDOW.

    I hope Adobe is aware of these little quacks with CFWINDOW