Hi All

Was wondering if anyone could help me on this problem i am having.

I have a form which contains a foreach loop and this loop outputs as
many generated input fields as there is data in the database.

My jQuery validation on submit is only seeming to validate the first
input box of however many input boxes.
I would like validation to check all the inputs and if requirments are
met for the inputs then return true or else return false if it doesnt
meet the requirments of the custom validation method.

This is the input box inside the foreach, the foreach can output many
of these filling in different data using the variables.

<input type='text' class='inputval' name='donation'  id='".$d
['ee.club_event_entries_id']['value']."' size='4'/>

My validation right now is checking the class "inputval" but it only
seems to check the first input.

Here is my validation:

                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();

And i am also checking for validation on a button.click in jquery.
This validation is not checked on form submit but rather on a jquery
button click.

Here is the button with check:

                        $('.pay').click(function() {
                                if(!$('#checkoutform').validate().form()){
                                        return false;
                                }

Any advice on this problem will be greatly appreciated. i have tried
looping through in the validation using a .each so that it checks all
inputs but even this fails.

Thanks


Reply via email to