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

Thread: submit method ?

  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    submit method ?

    hello,
    I'm wondering what methods I could use to submit a form,

    currently I must hit the submit button, but what I'd like to be able to do it just hit tab when I read the last <select> box on the page, and have the form submit from there, is this possible? and if so, how?

    thanks in advance for your time!
    -Ken

  • #2
    Regular Coder
    Join Date
    Jul 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Take a look a the form.submit() function. You could add an onblur handler to your select to call submit. Something like this (untested):
    Code:
    <select name="myselect" onblur="this.form.submit()">
    The problem with onblur is that no matter how you left the select it would submit the form. A better way would be to add an onkeydown handler and call submit if the key pressed was tab.

  • #3
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Or

    Code:
    <select name="myselect" onchange="this.form.submit()">
    With this though, make sure you have a default selection to change from.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    hmm,
    ok, only question now is,
    I'm already using this:
    onChange='Add()'

    in the <select>, so how can I use both at once?
    like?
    <Select name='select' onChange='Add()';onblur='this.form.submit()'>

    thanks again for your time!

    -Ken

  • #5
    Regular Coder
    Join Date
    Jul 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The problem with using onchange is the user cannot use the keyboard to make a selection unless they open the drop box first. Most don't know that they can open it from the keyboard.

  • #6
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    well, the onChange is for another function on the page,
    I still want to use the onBlur for the submit, but not sure how to use both at once.

    any ideas?

    thanks again for your time!
    -ken

  • #7
    Regular Coder Nischumacher's Avatar
    Join Date
    Oct 2005
    Location
    Bombay, India
    Posts
    196
    Thanks
    0
    Thanked 2 Times in 2 Posts
    <Select name="select" onchange="Add()" onblur="this.form.submit()">

    if you want both on the same event... then simply put this.form.submit() as the last line in your Add() function....
    - NS 666
    .net DEVILoper

  • #8
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    kool,
    that did the trick;-)

    thanks!
    -ken


  •  

    Posting Permissions

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