Hi all

I was wondering if someone could please help me with the jquery
validation. I have a foreach loop that creates many input text rows
and i would like jquery validation to check on button click if each of
the input boxes meets the requirements. Right now on button click it
is only checking the first input box and if that is true then the
button works but i want validation to check all three inputs to see if
they are TRUE and then only should the button work.

Thanks

Code:

//Button click with validation check inside document.ready()
$('.pay').click(function() {
        if(!$('#checkoutform').validate().form()){
                return false;
        }
});

//JQuery custom method outside document.ready()
                jQuery.validator.addMethod("inputval", function(value, element) 
{
                        staticval = $('#prevalue'+element.id).val();
                        currentVal = element.value;
                        if(Number(currentVal) < Number(staticval)){
                                
if($(element).parents('.container').find('table.subtotal-table').is
(':hidden')){
                                        
$(element).parents('.container').find('.minimize').click();
                                }
                                return false;
                        } else {
                                return true;
                        }

                }, '<font color="black" size="1px">Min Amt or higher required.</
font>');
                $("#checkoutform").validate();

//one of the inputs in the foreach. These can become multiple inputs
//This code is inside the form checkoutform

<td width="10%" ><?php echo ($showbox)?"<input type='text'
class='inputval' name='donation'  id='".$d['ee.club_event_entries_id']
['value']."' size='4'/>".$prevalhidden:$d['ee.fee']['value']?></td>

Thanks for the help


Reply via email to