Results 1 to 2 of 2

Thread: extjs4: how to submit the same form data twice

  1. #1

    Default extjs4: how to submit the same form data twice

    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:
    Code:
    validateForm: function(button){
            console.log('Validatingform');
            var formData=button.up('form').getForm();
            if(formData.isValid()){
                Ext.Ajax.request({
                    url : 'MyServlet',
                    params : {
                        inputData:Ext.encode(formData.getValues()),
                        validate:"valid"
                    },
                    scope : this,
                    success : this.onValid,
                    failure : this.onInvalid
                });
            }
        },
    
    
    onValid: function(response,button){
            console.log("Valid");
            //on valid-enable save button,disable submit button
            Ext.getCmp('myFormSubmit').setDisabled(true);
            Ext.getCmp('myFormSave').enable();
    
    
        },



    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

  2. #2
    Sencha - Support Team
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    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.

    Scott.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •