Welcome Guest, Not a member yet? Register   Sign In
One validation callback when using arrays
#1

[eluser]Unknown[/eluser]
Hello,

Is it possible to set validation callback on post array, that it would be called only once?

If I have:

Code:
<input type="text" name="birthday[year]" value="" />
<input type="text" name="birthday[month]" value="" />
<input type="text" name="birthday[day]" value="" />

Code:
$val->set_rules('birthday', 'Birthday', required|callback__birthday_check');

_birthday_check is called three times each time passing same array, and if I use "birthday[]" instead of "birthday" in set_rules then _birthday_check not called at all.

Please do not suggest not using arrays or doing validation for each field separately. This is just an example. If i had a big checklist, which should be validate using database, multiple callbacks would execute many SQL queries.

Thank you for your help :-)


Messages In This Thread
One validation callback when using arrays - by El Forum - 09-23-2010, 10:25 AM
One validation callback when using arrays - by El Forum - 09-25-2010, 02:37 AM
One validation callback when using arrays - by El Forum - 10-20-2010, 06:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB