View Full Version : How to add validation to existing html form

12 Aug 2010, 12:06 PM
Hello all,

I have an html dialog, with form elements (input type text, textarea, etc.) already made.
I would like to add ExtJS validation to it. How can I do that?

I spent searching the Net for 2 hours and I could not find any ways to do this other than creating the forms dynamically through a config. Obviously I can't do that, my application is already existing, I just would like to add extjs validation to it.
Any ideas?


12 Aug 2010, 1:27 PM

I'm assuming your form must be huge if you need to do something like this. Like 50 fields or more? If you want to use extjs validation on an already existing setup, it's going to be complicated. You'll have create a function with logic like this:

function changeFieldsToExtjs()
for(html input element type)
do a dom query for elements of that type and get a array of the ids
for(ids in your array)
do a dom replace on the element to an extjs element of that fields with the correct type and same ID and the general validation you want
add special validation to specific fields.

In the end, converting to use full Extjs is just easier and more efficient.