Formpanel can be used as follows:
Var panel = Ext. create ('ext. form. panel ', {title: 'simple Form', bodyPadding: 5, width: 350, // will be submitted to this URL through AJAX requests // url: 'save-Form. php', // form field Fields will be vertically arranged, full width layout: 'anchor', ults: {anchor: '000000'}, // The fields ultulttype: 'textfield', items: [{fieldLabel: 'First name', Name: 'first', allowBlank: false}, {fieldLabel: 'Last name', name: 'last ', allowBlank: false}], // reset and save button. buttons: [{text: 'reset ', handler: function () {this. up ('form '). getForm (). reset () ;},{ text: 'save', formBind: true, // only enabled once the form is valid disabled: true, handler: function () {var form = this. up ('form '). getForm (); if (form. isValid () {form. submit ({success: function (form, action) {Ext. msg. alert ('saved successfully', action. result. msg) ;}, failure: function (form, action) {Ext. msg. alert ('Operation failed', action. result. msg) ;}}}}], renderTo: Ext. getBody ()});
Looking at the API, formpanel has no url configuration and does not obtain the api function .. It should be the parameter of the formpanel parent class ..
Later, I went to ext. form. basic and found the url configuration item ..
In Ext, FormPanel does not store form data. The data is saved by BasicForm. When submitting a form, you need to obtain the BasicForm in the current FormPanel for submission.
After obtaining the BasicForm object, you can submit the form.
Because two components need to be used in the project, the only difference between the two components is that the submitted url is different, so I didn't define the url when defining the component.
Then, when the component is added to different containers, different URLs are also given. The example above is used as an example.
Where needed
Panel. getForm (). url = '../LogSelectServlet'; // you can assign different URLs in different places.
This method is a good method for Component reuse ..