Welcome Guest, Not a member yet? Register   Sign In
validating unkown number of related fields
#1

[eluser]RMoygy[/eluser]
Hi. I have a set of related fields that can be created dynamically, via javascript, by the user. I'm not sure how to use CI's validation facilities without knowing the number of fields ahead of time.
#2

[eluser]RMoygy[/eluser]
I should of added that they are input fields.
#3

[eluser]llbbl[/eluser]
created dynamically?
#4

[eluser]RMoygy[/eluser]
Yeah. I'm going to show 3 or 5 input fields by default, but give the user the ability to create more if they need more.
#5

[eluser]llbbl[/eluser]
If its optional fields you don't need to validate right, other than xss_clean them of course.
#6

[eluser]RMoygy[/eluser]
Yeah, I still need to validate them. They are actually pairs of fields. The requirments are that if one of the fields in the pair has text then they both must, and the second field of the pair should look like a valid url.

I came up with a (not so elegant) solution, if anyone's interested I'll post it.
#7

[eluser]llbbl[/eluser]
if you are creating the fields w/ javascript dynamically, why don't you just do the form validation with javascript then. I saw someone on here using this library that comes with built in validation.

http://extjs.com/




Theme © iAndrew 2016 - Forum software by © MyBB