I am using symfony 1.4 with propel as a backend and have the following use-case:
In my form (generated with symfony propel:generate...) is a dropbox (of class sfWidgetFormPropelChoice) from where the user can select an address (any record from 'address' table). Let's say the selected address has the id '4'. I would like the user to be able to press an edit button right next to the dropbox and a he/she is redirected to 'address/edit?id=4'.
Best case would be that in this form the 'save' button is replaced by 'save and return', but that is a problem which is to be solved later.
I assume that I have to create a new widget class subclassing sfWidgetFormPropelChoice for that -- since I want to do that again in other forms it seems to make sense. I thought about overriding the render() method in the subclass and add a simple submit button. Then I would have to touch the create and update actions and change them to look if this button was pressed instead of the save button, and if it was pressed do the redirection. That seems a little odd to me, because create and update should -- for the sake of clean code -- just create or update ... still there is a method processForm() which is called by both actions which could be the right place.
I could use JavaScript to redirect, but I would prefer a JavaScript free solution.
Anyone another idea? Maybe I could use a facility already provided by symfony which I don't know yet. Or something comparable was already done where I can learn a lesson or two from by studying.
Thx for any direction.
