SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a weird call to a function

    Hi,
    I have created a form with a "submit" button and a function
    that onsubmit checks that the user filled all the necessary fields.
    Within the form I have a "checkAvailability" button
    that checks if the desired login is already in use,
    by calling to some other function.

    The problem is, that when I press on the "checkAvailability"
    button, for some reason, also the submit function
    (that checks that the user filled all the necessary fields)
    is being called...

    why is that?
    I'm attaching my file...

    thanks!
    Attached Files Attached Files

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Clicking any button in a form seems to submit the form in Mozilla browsers. The solution used to be to make the button's onclick handler return false. Dunno if that still works though.

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By default, html buttons have the type attribute set to submit- make sure the type is explicitly set to 'button'.


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
  •