SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs down two submits issue

    Hi,

    I have a form which I need to submit in order to retrieve a few values according to user selections firstly, and then let he finish the filling and then submit it again.

    I realize (after some soffering) that the first submition (made by a select input onchange event handler calling a js function) only works while the submit button isn't on the page ( so I hide it using server code based on a value changed after the js function runs).

    My issue:

    Since the js submit only works while the button isn't loaded, the user can't use the select again to shift their choice...

    Already tried: (no luck for any)

    Hide the input button using the hidden property.
    Reload the page when the select is used.

    Any clue?

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    only works while the submit button isn't on the page
    I bet that's because the NAME or ID attribute of that button is "submit". If you fix that you shouldn't have to hide/show it.

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks jimfraser...it worked
    One question: Why the formname.submit() on my js function has something to do whith my inpyt submit button name?

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically if you give a form element the name SUBMIT, you are overwriting the form.submit function.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok. understood...

    Thanks again!

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,863
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You only override it in IE because IE pollutes the Javascript namespace with shortened versions of HTML references instead of allowing the programmer to decide for themselves what should be set to what. Other browsers don't automatically assign names that you don't want or need for every HTML element in your page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This test code fails equally well in IE and Firefox:
    Code:
    <html>
    <head>
    </head>
    <body>
    	<form method="post" action="someurl.html">
    		<input type="submit" name="submit" value="ok" />
    	</form>
    	<button onclick = "document.forms[0].submit();">click</button>
    </body>
    </html>


Bookmarks

Posting Permissions

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