Skip navigation
Currently Being Moderated

CFwindow validation on Checkbox

Oct 24, 2010 1:55 PM

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>

 
Replies
  • Currently Being Moderated
    Oct 24, 2010 3:21 PM   in reply to umuayo

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points