Welcome Guest, Not a member yet? Register   Sign In
Validate Form Array
#1

[eluser]nigelb[/eluser]
Hi

I have a form field array that I want to submit to a database. Is there a way that I can use the CI validation rules on this.

Currently I am experimenting with javascript but not having much luck.

Code:
function checkuploads(form) {
    
    
    var file;
    var q;
    for (i=0; i<form.elements['partnumber[]'].length; i++)     {
        q=i+1;
        if (form.elements['partnumber[]'][i].value!= '') {
            //file += form.elements['user_files[]'][i].value;
            if (form.elements['location[]'][i].value='') {
                    alert("Enter Location in row"+q);
                    return false;
            }
            if (form.elements['qty[]'][i].value='') {
                    alert("Enter Qty in row"+q);
                    return false;
            }
    
        }
        return true;
    }
    
}
#2

[eluser]xwero[/eluser]
SVN has an improved validation library that allows you to use arrays.
#3

[eluser]drewbee[/eluser]
Yup. All Hail the coming of CI 1.7!!
#4

[eluser]nigelb[/eluser]
when is it coming?
#5

[eluser]drewbee[/eluser]
[quote author="Pink Digital" date="1220382950"]when is it coming?[/quote]
When Its Ready! :coolsmile:




Theme © iAndrew 2016 - Forum software by © MyBB