Ext Form Form Submit data Method summary _yui. Ext Related

Source: Internet
Author: User
Ext form Forms Form AJAX Submission (default submission method)

Copy Code code as follows:

1. Function login (item) {
2.
3. if (Validatorform ()) {
4.//Login button set to Disabled to prevent duplicate submission
5. this.disabled = true;
6.
7.//The first parameter can be submit and load
8. FormPanl.form.doAction (' Submit ', {
9.
URL: ' User.do?method=login ',
11.
Method: ' Post ',
13.
14.//If there are other parameters other than the form, you can add it here. I am temporarily empty here, can also be omitted from the following sentence
Params: ',
16.
17.//The first parameter is to pass in the form, and the second is the Ext.form.Action object used to get the JSON data from the server.
Success:function (form, action) {
19.
Ext.Msg.alert (' operation ', action.result.data);
this.disabled = false;
22.
23.},
Failure:function (form, action) {
25.
Ext.Msg.alert (' warning ', ' username or password is wrong!) ');
27.//Login failure, reset the submit button to be operable
this.disabled = false;
29.
30.}
31.});
this.disabled = false;
33.}
34.}



Non-Ajax submissions for 2.EXT forms

Copy Code code as follows:

1.//Implement non-Ajax submission form must add the following two lines! OnSubmit:Ext.emptyFn, Submit:function () {
2.//Reset the action address again
3. This.getel (). dom.action = ' user.do?method=login '; This.getel (). Dom.method = ' post ';
4. Submit Submission
5. This.getel (). Dom.submit ();
6.},


3.EXT of Ajax submission

Copy Code code as follows:

1.
2.
3. Ext.Ajax.request ({
4.//Request Address
5. URL: ' login.do ',
6.//Submit parameter Group
7. Params: {
8. LoginName:Ext.get (' LoginName '). Dom.value,
9. LoginPassword:Ext.get (' Loginpassword '). Dom.value
10.},
11.//Callback when successful
Success:function (response, options) {
13.//Get the response's JSON string
var Responsearray = Ext.util.JSON.decode (Response.responsetext);
if (responsearray.success==true) {
Ext.Msg.alert (' Congratulations ', ' You have successfully logged in! ');
17.}
else{
Ext.Msg.alert (' failed ', ' login failed, please login ');
20.}
21.}
22.});

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.