PDA

View Full Version : Is there a way to change value of form after validation passed and before submitting



laiboonh
27 Mar 2014, 7:37 PM
Hi,
the context of this question is i want to validate password field in a form but after doing a encoding the result fail the validation. Hence i would like to slip in my encoding code before for submission but after validation passed.

Can this be done?

israelroldan
2 Apr 2014, 11:47 AM
Are you using a bound record? Are you using the form.submit method? Or are you submitting the form on your own?

laiboonh
2 Apr 2014, 6:22 PM
I am following the MVC architecture and using controller to capture a submit button click event.


onButtonClickSubmit: function(button, e, options) {
var formPanel = button.up('form'),
login = button.up('login'),
user = formPanel.down('textfield[name=user]').getValue(),
pass = formPanel.down('textfield[name=password]').getValue();

pass = MyApp.util.MD5.encode(pass);
login.getEl().mask("Authenticating...Please wait...", 'loading')

if(formPanel.getForm().isValid()) {//i would still like the form to verify user inputs, however because of the encode function earlier the password field fails validation
........and so on
}
},