Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to fire the onchange event programmatically?

    Hello all.
    I have an urgent question and I wish someonene could answer:
    Is it possible to fire the onchange (for a dropdownlist) event programmatically from javascript?
    Actually I have created a function to link two Dropdownlists in a Parent-Child relation, but the problem is that if I have more than two level relation betwen my DDLs, the onchange event doesn't fire for the non direct ChildDDL.

    For example, I have a function
    loadChildOptions(ParentDDL, ChildDDL){
    //function to change ChildDDL options relatively to ParentDDL
    //ChildDDL.options.add(...);
    //ChildDDL.selectedIndex=0; but the onchange event of ChildDDL doesn't fire
    }
    I need to fire the onchange for ChildDDL from the loadChildOptions function.
    Any idea about this?
    Last edited by dotNetCoder; 03-14-2005 at 10:00 AM.

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Have you tried:ChildDDL.onchange();?
    *this message will self destruct in n-seconds*

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks a lot, it works

    Hi codegoboom, thanks a lot, now it works.
    I have tried before ChildDDL.onchange (without parenthesis) and it didn't work, now ChildDDL.onchange(); is working.
    But I have a question about this method compatibility.

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts

    compatibility?

    I'll guess that would come down to which events you're calling... btw, onchange.call(); seems to work too.
    *this message will self destruct in n-seconds*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •