OK. So, say I have an action, the createFolderAction, which creates a folder
on a filesystem. It creates an instance of Zend_Form, adds a text element to
allow the user to specify the folder name, and adds a validator that
verifies that the folder does not already exist before creating it. If the
validation fails, the user gets a message that says something like "folder
already exists, pick a new name".

Now, a new action is being added to the same controller, the
uploadFileAction. It creates an instance of Zend_Form, adds a file element
to it, and a select element to choose what folder to put the file in. Yay.
Oh, there is one more field, and that's the one that matters. This is a text
element that allows the end user to create a, you guessed it, new folder to
upload the file to.

In order to avoid duplicate code, it seems like I should delegate [from the
uploadFileAction] to the createFolderAction to handle the optional folder
creation. I understand that you can push actions into the action stack or
forward from one action to the next. Unless I'm missing something, this
creates a problem for me:

When I create an instance of Zend_Form in uploadFileAction. It has three
elements: 

file element - the file to be uploaded
select element - the folder to upload it into
 - or - text element - new folder to create and upload to (if "new" is
selected in the select folder element, this value is used)

That's pretty much the problem... I can't really forward to the
createFolderAction from here, because that will create an different instance
of Zend_Form / text (foldername) element. It will see the posted value, but
if it does not validate the error will not be returned to the correct form,
etc. 

So, where am I going wrong?

Thanks,
Oak
-- 
View this message in context: 
http://www.nabble.com/Question-about-running-multiple-actions-in-a-request-tp16172118s16154p16172118.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to