views:

240

answers:

2

I want to allow users to add textbox element using javascript by clicking the add button.

I would like to know how I can use Zend validate to validate those elements that are created by javascript.

A: 

addPrefix to the new added and then check for prefixed keys in $_POST and add the fields to the form. There is no easy way to do this.

Tomáš Fejfar
+2  A: 

There is no built in way for that but it shouldn't be too tricky to do this.

Firstly, I would suggest naming your JavaScript-generated elements with array notation, ie. name='someName[]', so that PHP parses them into an array in POST/GET.

Then, you can simply loop over the resulting array, and call your validator(s)/validator chain.

Jani Hartikainen