I have a zend form, and I need to provide a dynamic link on the form. ie. user tries to select from drop-down -> if desired option not present, click on the adjacent link to open another form where they can add the option. The link will be dynamic because I want to post some data from the current form using GET (the country and region already selected for example).
How can I do this?
You could do this client-side using javascript/AJAX – detect clicking on the link, collect form data and continue to a different page. If you need a fancy URL of the other page, you’d have to make an AJAX call to the server to get the fancy URL based on the form parameters,
or
make the link a submit button actually, process the form server-side (detecting that the special submit button was clicked; example here) and do a redirect to your other page.
As for rendering the link next to a Zend_Form_Element, you can do this in a few ways, one of them would be placing it in the label or description (
setLabel(),setDescription()) while making sure to set theescapeparameter of the decorator tofalse(example here)