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 5 of 5

Thread: error

  1. #1
    New Coder
    Join Date
    Oct 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error

    var el=event.srcElement.parentElement;
    document.el.submit();

    this has an error but i dont know what it is... please help...tnx=)

    Admin warning Please use a more descriptive subject in the future. See: http://www.codingforums.com/postguide.htm
    Last edited by WA; 01-14-2003 at 04:02 AM.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    el should contain a complete reference to the form. No need to prefix it with document.

    var el=event.srcElement.parentElement;
    el.submit();

    However, I must ask, what IS the srcElement here? If it's an INPUT, TEXTAREA, or SELECT, you don't need to do that. Is this in a function? How is the function called?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    New Coder
    Join Date
    Oct 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    heres a part of the code where the el comes from:

    function gotoform()
    var el = event.srcElement.parentElement;
    el.submit();

    <select name="rating" onChange="gotoform();">
    </select>

    since el is the select tag, i want to submit the form where the select tag belongs.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why not just...

    <select name="rating" onChange="this.form.submit();">
    </select>

    ???
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    New Coder
    Join Date
    Nov 2002
    Location
    London, UK
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Or if you do have to go into the gotoform() function for other reasons that arent apparent in the snippet you have posted just use :-

    Code:
    <select name="rating" onChange="gotoform(this)";>
    </select> 
    
    functiuon gotoform(t)
    {
     ....
     ....
     t.form.submit();
    }
    Adam


  •  

    Posting Permissions

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