jQuery.YAV get the rules added in the HTML attributes onSubmit so,
if your form exists when the code starts, the validation must work (although
you add dinamically, with AJAX, some new fields), but if you load later
completally the form, you need call to $().yav() method. You don't need
Livequery for this.

FIRST POSSIBILITY:
<div id="fullform">
   <form id="myform" action=....>
      <input id="some" class="required" />
      <div id="ajaxfields">
         <input id="some2" class="required alphaspace" />
      </div>
   </form>
</div>

JS:
$("fullform").yav();
$("ajaxfields").load("ajaxcall.html");
//Works OK

SECOND POSSIBILITY:
JS:
$("fullform").yav();
//If you reload with AJAX all DOM for the form
//yav submit event is missed, you need resetting
$("fullform").load("ajaxcall2.html", function(){
   $(this).yav();
   //Now works
});

This is the same if you load AJAX content with $.post,
$.get or any ajax method of jQuery, if you reload the
DOM of the main form, all the old events are missed
because really it is not the same DOM object (you remove
and create again), so you need re-attach again the
events handlers.


lvp1138 escribió:

jQuery.YAV is a input validation plugin based on the popular YAV.

Normally, a call like this:

$(document).ready(function(){ $("#form1").yav(); });
will be enough to call Yav to do input validation when the form is
submitted.

However, on our software, the forms are being added dynamically via AJAX, so
livequery would be required.

We've tried every possible way of doing this with livequery, but we can't
achieve the desired result. If we put them form on the main document, not
through an AJAX call, YAV works fine, so we know our syntax is ok and all
the necessary jscript files are being loaded ok.

Can anyone suggest the correct livequery syntax for this? We've used
livequery before for other things, but this one has us baffled.

Your suggestions will be greatly appreciated!

Peter :)


--
Best Regards,
José Francisco Rives Lirola <sevir1ATgmail.com>

SeViR CW · Computer Design
http://www.sevir.org
Murcia - Spain

Reply via email to