Three data submission methods for ext)

Source: Internet
Author: User
1. Ext form Ajax submission (default submission method) 1. Function login (item ){
2.
3. If (validatorform ()){
4. // set the logon button to disabled during logon to prevent repeated submission.
5. This. Disabled = true;
6.
7. // The first parameter can be submit or load
8. formpanl. Form. doaction ('submit ',{
9.
10. url: 'user. do? Method = login ',
11.
12. Method: 'post ',
13.
14. // if there are parameters other than the form, you can add them here. I am currently blank. You can also omit the following sentence.
15. Params :'',
16.
17. // The first parameter is to pass in the form, and the second is the Ext. Form. Action object used to obtain the JSON data transmitted by the server.
18. Success: function (Form, Action ){
19.
20. Ext. msg. Alert ('operation', action. Result. data );
21. This. Disabled = false;
22.
23 .},
24. Failure: function (Form, Action ){
25.
26. Ext. msg. Alert ('Warning ', 'user name or Password error! ');
27. // Logon Failed. Set the submit button to operable.
28. This. Disabled = false;
29.
30 .}
31 .});
32. This. Disabled = false;
33 .}
34 .}

2. Non-Ajax submission of ext forms1. // The following two rows must be added for non-Ajax form submission! Onsubmit: Ext. emptyfn, submit: function (){
2. // set the action address again
3. This. getel (). Dom. Action = 'user. do? Method = login '; this. getel (). Dom. method = 'post ';
4. // submit the submit
5. This. getel (). Dom. Submit ();
6 .},

3. Ajax submission of ext 1.
2.
3. Ext. Ajax. Request ({
4. // request address
5. url: 'login. Do ',
6. // submit the parameter group
7. Params :{
8. loginname: Ext. Get ('loginname'). Dom. value,
9. loginpassword: Ext. Get ('loginpassword'). Dom. Value
10 .},
11. // callback upon success
12. Success: function (response, options ){
13. // obtain the response JSON string
14. var responsearray = ext. util. JSON. Decode (response. responsetext );
15. If (responsearray. Success = true ){
16. Ext. msg. Alert ('congratulation ',' you have successfully logged on! ');
17 .}
18. else {
19. Ext. msg. Alert ('failed', 'logon failed, please log on again ');
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.