Input, button, different type value the trap that results when the Ajax submits the form _ form effects

Source: Internet
Author: User
Tags button type error handling
Today in doing the use of connection as a form submission process found that the label "input" and "botton" in the Type attribute setting is also a learning.
In the development process, to make the HTML code cleaner, I first submitted the form using the YAHOO.util.Event.addListener (obj, "click", Callback) class to load the "click" Event. YAHOO.util.Connect.asyncRequest (' POST ') to upload form data, if the form information is incorrect, then return processing. And the submitted button I adopted is <button type= "submit" > Submit </button>.
In addition to IE6 to be able to make the correct processing of my form data, Firefox including IE7 can not respond to my error handling (callback method, the error is handled in the way is: as long as the error, then return by returning false way).
At this time in my thinking is, in the statement before submitting the form data I have done return processing, but the page is still to refresh it.
Back home in the evening again to test the problems encountered today, as it turns out, I overlooked a point where the data was actually submitted, and the data was clearly visible in the address bar, and the fact that the data was definitely being submitted made it possible to think of my button, and the category setting for the button was "submit", Before writing code, are directly in the "input" or "button", if the category is set to "submit" when the onclick= "return Fun ();" or onclick= "Fun" (); return false; This naturally is not a problem, strange blame, AddListener class value is not directly affect the button, a click button, Nature will submit data.
Painful AH ~ ~ ~ ~ ~
Attach: Button The default type value is Submit, so it is best to identify the next category!!! Remember!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.