PDA

View Full Version : [SOLVED]How to validate a form?



redlz2500
24 Jan 2008, 7:29 AM
hi~
i wrote a formpanel
the vtype of its items are working well,
i means if the input is not legal by my set, the tipMsg will show
but i can still click the button sumbit

so i catch the onsumbit events, and want to write some code here to cancel the sumbit action when the input data is not legal

but i find the method return value of Ext.form.VTypes is void
i don't know how to validate with Extjs

could someone tell me the right way to cancel user sumbit when the input data is not legal

devnull
24 Jan 2008, 10:17 AM
in general if you are wanting to do some advanced form validation before submitting you would write your own submit handler rather than relying on any built-in handler. Also the form.isValid() and form.isDirty() methods may be of use to you.

redlz2500
25 Jan 2008, 3:38 AM
thanks for your advise,
it is usefule~