[validate] Validating an AJAX loaded form
So there is a decent number of this same question on this forum, but either without solutions or with solutions that I'm just not sure if its that great... I would love if someone could help me out with this and hopefully we can get this thread to be a good reference point for all those others.
I have a small, two input form that is being loaded when the user clicks on a link. This form is loaded via ajax. It does not initially exist, only a div exists in its place, ready to have the form loaded there.
The inputs have classes to them "title" and "description". In my validation js file, these classes are defined as part of the addClassRules bit. I also have some default messages set ( $.extend($.validator.messages). Both the validation rules and the default messages I have set are working.
But when I try to add specific validation rules/messages for just this form I load...
- $("#ajaxloadedform").validate({ blah blah blah })
.... nothing inside this validate works. But if I wanted to test...
- $("#ajaxloadedform").valid()
... this does work. I'm assuming, as many others before me have, that its the ajax load issue. But it puzzles me why some parts of it work while other parts do not.
Thanks in advance for any assistance you can offer!