Array input validation help |
I am working on this application which i need to achieve something like this, in the system we are allowing the system administrator to add customers and their vehicles,
Customers can have one or more vehicles, by default there are 8 fields to add the information of customer's vehicle. here are the fields for first entry. Code: <input type="text" name="number[0]" id="number" class="form-control name_list"/> and my interface is like this. ![]() by clicking "Add another" user will get another set of same fields (same 8 default fields ) field names of this set will be like with array[1] Code: <input type="text" name="number[1]" id="number" class="form-control name_list"/> note that the index of the array changes with the each vehicle, if a person have 5 vehicles then the number field will be like number[0],number[1], number[2], number[3], number[4], number[5] same will be for other 7 fields. i am using following jquery & codeigniter validation rules for validation. here's my jquery script. Code: $( document ).ready(function() { ex: name="number[0]" id="number[b][0]" [/b] but when use [b]name="number[0]" id="number[b][0]" [/b][/b] the validations not working. even i tired $this->form_validation->set_rules('number[]', 'Number', 'required|min_length[7]'); [b]$this->form_validation->set_rules('number[0]', 'Number', 'required|min_length[7]');[/b] [b]no luck.[/b] please help me here. i have a deadline to meet. all i need is validate first basic 8 fields and the ones users adding using "Add another" button |
Messages In This Thread |
Array input validation help - by greenarrow - 07-28-2016, 09:34 AM
RE: Array input validation help - by mwhitney - 07-28-2016, 10:42 AM
RE: Array input validation help - by greenarrow - 07-28-2016, 11:31 AM
RE: Array input validation help - by mwhitney - 07-28-2016, 01:27 PM
RE: Array input validation help - by greenarrow - 07-29-2016, 02:26 AM
RE: Array input validation help - by mwhitney - 07-29-2016, 06:22 AM
RE: Array input validation help - by PaulD - 07-28-2016, 12:03 PM
RE: Array input validation help - by greenarrow - 07-28-2016, 12:30 PM
RE: Array input validation help - by greenarrow - 07-28-2016, 11:19 PM
RE: Array input validation help - by dave friend - 07-29-2016, 07:57 AM
RE: Array input validation help - by PaulD - 07-29-2016, 08:17 AM
|