Onblur prevents onsubmit while submitting form.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Trisha8
    New Member
    • Feb 2013
    • 7

    Onblur prevents onsubmit while submitting form.

    i have validation functions which is being called on onblur of respective input field. at the same time i am calling same validation functions with one say 'validateall()' function and 'validateall()' is being called on 'onsubmit'.
    now the problem is if some error has occured and i have corrected it and submit the form at that time 'onblur' is being called which is preventing from calling 'onsubmit' event.
    this problem i am facing in Firefox only.
    please help me out, its very urgent.

    Thank u in advance.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    We would need to see your code.

    Comment

    • Trisha8
      New Member
      • Feb 2013
      • 7

      #3
      Code:
      function validateFormOnSubmit(theForm) 
      {
      vUsername(theForm.userName,document.getElementById('UError'));//this will return true or false depends on error occurrence. 
      }
      
      
      <form name="form" onsubmit="return validateFormOnSubmit(this);">
      <input type="text" id="userName" onblur="vUsername(this,UError);">
      Last edited by Trisha8; Feb 8 '13, 07:49 AM.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Please use code tags when posting code.

        Your validate code needs to return the value from the username function. If that doesn't work, we need to see the code for your username function.

        Comment

        • Trisha8
          New Member
          • Feb 2013
          • 7

          #5
          Rabbit
          VUsername will return count of error and depend on that count validateFormOnS ubmit() will return true or false.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Perhaps that's what you want it to do. What I've been trying to tell you is that your validateFormOnS ubmit() function doesn't return anything.
            Last edited by Rabbit; Feb 9 '13, 04:47 AM.

            Comment

            Working...