View Full Version : extjs4: how to submit the same form data twice

14 Oct 2014, 2:59 AM
I have an input form with 2 buttons, submit and save. Initially both buttons will be disabled. Once,the user enters the data, the submit button will be enabled and he submits the form,which goes to the servlet for validating(By validating,I mean I send the userID and password to check if it is existing in the database)
Here is my handler for submit button:

validateForm: function(button){
var formData=button.up('form').getForm();
url : 'MyServlet',
params : {
scope : this,
success : this.onValid,
failure : this.onInvalid

onValid: function(response,button){
//on valid-enable save button,disable submit button


After checking for validation. In the OnValid method, I enable the save button and click on save button to save the form data now.
But since,the form was already submitted,the input to my servlet is "null" which means that the 'formData' is "null".
I am not sure on how to hold this form data entered by the user for multiple submits. Can anyone please help me in solving this.

Thanks in advance

14 Oct 2014, 9:23 AM
I am not sure of your logic here, but if the callback from the submit is valid send a status back to keep/remove the submitted data on the server or update a status, etc. Sending the data twice would be bad practice.

Or reverse the logic and check for a status and then submit.

Use ajax request for either option.