PDA

View Full Version : Form validations using model validations



dedoz
27 Jan 2012, 12:06 AM
is there a way to map model validations to form validations ? So when the form needs to validate a field uses the model validations ?

I have a model with some validations declared, and then load a record.
Then i use form.loadRecord() to load that record values into the form.

i have to declare validations twice ? in the model and then in the form ? can i tell to form to use same model validations for each field ? or is there a way to map this two things ?

(sorry for my bad english)

jay@moduscreate.com
31 Jan 2012, 8:06 AM
I would just declare validations in the forms. They are way more useful.

xava
7 May 2013, 4:19 PM
i am just searching for this,
how to map model validation to form validation

really there isn't a way to do it?

in this case, what is better? forget model validation and just use form one or do it twice? look weird

thanks you

xava
7 May 2013, 4:50 PM
i found two possible solutions to bind a model validation with form validation from one year ago, maybe there is something better today?

thanks :)

http://www.sencha.com/forum/showthread.php?135732-Ext-4-Validating-a-Form-with-a-Model&p=778233#post778233

http://www.sencha.com/forum/showthread.php?125242-Form-lt-gt-Model-binding&p=599286&viewfull=1#post599286 (http://www.sencha.com/forum/showthread.php?135732-Ext-4-Validating-a-Form-with-a-Model&p=778233#post778233)