What about using _forward() instead? Regards, Saša Stamenković.
sagittariidae wrote: > > Thank you for all your suggestions guys. > > I can see why javascript would be a useful choice for this problem but I > have opted to figure out the action to perform server-side, using php to > determine which submit variable is present in the POST variables and its > seems to be working for me (so cheers for the idea Mark). Now for the next > problem (which I should probably put in a new thread) but I need to > redirect to an external url with a POST request containing all my form > values. From what I have read a redirect would not send the POST variables > and creating a HTTP Client would mean that that even tho I could post to > the external url the browser would not actually be redirected to the > external url. > > Anyway, thanks for the advice, Matt > > > Jurian Sluiman wrote: >> >> Well, even if it works on some (or most) browsers, it's not the most >> wonderful >> option. >> >> The best is imho to provide your local url as action. By pressing the >> submit >> button for your remote site you can change the action with javascript. If >> javascript is not enabled, you can always check serverside at your local >> action if the "remote submit" is pressed and forward the action with the >> redirector. >> >> Then it's for the most users very friendly, but with js turned off it >> still >> works. >> >> Regards, Jurian >> -- >> Jurian Sluiman >> Soflomo.com >> >> Op Tuesday 23 June 2009 14:44:28 schreef Ramon de la Fuente: >>> Actually.. submitting by Return key or Space fires the onClick event on >>> the submit buttons. (go figure) >>> [Google Chrome 2.0.172.31, IE 8, FF 3.0.11] >>> >>> >>> Ramon >>> >>> drm wrote: >>> > Watch out with javascript solutions, since it might give you trouble >>> > with submits by pressing the Return key to submit a form. >>> > >>> > Gerard >>> > >>> > Ramon de la Fuente wrote: >>> >> Also, if you have different actions depending on the button that >>> >> submits the request, you could >>> >> use Javascript to alter the "action" of the form prior to submit. >>> >> >>> >> The form tag looks like: >>> >> <form id="testform" action="" method="post"> >>> >> >>> >> The inputs look something like: >>> >> <input type="submit" onClick="setAction('local');" name="buy" >>> >> value="Local" /> >>> >> <input type="submit" onClick="setAction('remote');" name="buy" >>> >> value="LIVE!" /> >>> >> >>> >> And the setAction function something like: >>> >> <script> >>> >> function setAction(loc) { >>> >> if (loc == 'local') { >>> >> document.getElementById('testform').action = >>> >> '/controller/action'; >>> >> } else { >>> >> document.getElementById('testform').action = >>> >> 'http://www.remoteurl.nl/someform.php'; >>> >> } >>> >> } >>> >> </script> >>> >> >>> >> Ofcorse this could probably look a little smoother using your >>> >> favorite Javascript library... >>> >> >>> >> >>> >> Hope this helps, >>> >> >>> >> >>> >> >>> >> Ramon de la Fuente >>> >> >>> >> lightflowmark wrote: >>> >>> This is true of all HTML forms (AFAIK). I would approach this by >>> >>> having both >>> >>> forms submit to the same action (as you must), and using the >>> >>> redirector to >>> >>> conditionally redirect to the desired ultimate action, something >>> like: >>> >>> MyController.php: >>> >>> public function myFormAction() >>> >>> { >>> >>> if($this->getRequest()->getParam('button1')) >>> >>> { >>> >>> >>> >>> >>> $this->_helper->getHelper('Redirector')->gotoUrl('http://othersite.com/ >>> >>>',$this->getRequest()->getParams()) >>> >>> >>> >>> } >>> >>> else >>> >>> { >>> >>> //do form stuff locally >>> >>> } >>> >>> } >>> >>> >>> >>> >>> >>> Cheers, >>> >>> Mark >>> >>> >>> >>> sagittariidae wrote: >>> >>>> Hey all, >>> >>>> >>> >>>> I might be going the wrong way about it but I am looking to include >>> 2 >>> >>>> submit buttons on a form to choose from, one button posting to a >>> >>>> script on >>> >>>> another site and one posting back to an action in the same >>> controller >>> >>>> (with the ability to use the posted variables once there). Is this >>> >>>> possible using Zend Form? Surely the form action has to be assigned >>> >>>> before >>> >>>> the form is actually created so that is why I am stumped. I suppose >>> I >>> >>>> could have the form post back to a single action that checks which >>> >>>> button >>> >>>> has been pressed but then how would I post the variables to the >>> >>>> subsequent >>> >>>> script, would I use Zend_Http_Client? >>> >>>> Many thanks, Matt >> >> > > -- View this message in context: http://www.nabble.com/Multiple-submit-buttons-each-with-their-own-action-tp24150283p24167353.html Sent from the Zend Framework mailing list archive at Nabble.com.