0

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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.