I am trying to add validation for a form
$('#reportForm').validate({
rules: {
'report[invoices_attributes][0][invoice_type]' :
{
required: true,
'report[invoices_attributes][0][invoice_type]':true
}
}
});
reportForm is the id of my form. All of my input fields name values will be like 'report[invoices_attributes][indexnr]...'
( as I am using nesting attributes and there can be 0 or more elements )
For this, I want to match the input name value for all with a regex like : /^report\[invoices_attributes\]\[[0-9]\](.*)/
How can this be added to the rule field for input name value (currently 'report[invoices_attributes][0][invoice_type]'
), to match all the fields I'm interested in ?