Bart McLeod
Mon Zafra schreef:
I can see a way to do it, but it requires a 302 redirect, so your server gets hit twice after submitting. The js approach is better IMO.
// in your controller
public function init()
{
if (!empty($_GET)) {
$this->getHelper('Redirector')->gotoRouteAndExit($_GET);
}
}
-- Mon
On Tue, Mar 2, 2010 at 12:56 PM, David Muir <davidkmuir+zend@gmail.com> wrote:
Really? I'd like to know how they did that.
The only way I know of doing that would be using javascript to replace the
action on submit.
Otherwise, what you should get is:
/controller/action?param=value
with a form:
<form action="/controller/action" method="GET">
<input type="text" name="param" value="value" />
</form>
using jQuery:
$('form').submit(function(){
$(this).attr('action', function (index, action){
jQuery.each($(this).serializeArray(), function(i, field){
action += '/'+field.name+'/'+field.value;
});
return action;
});
});
the form should now submit to:
/controller/action/param/value
(in theory)
David
--
View this message in context: http://n4.nabble.com/Changing-get-parameters-to-controller-action-param-value-param-value-tp1574578p1574596.html
Sent from the Zend MVC mailing list archive at Nabble.com.
--
Bart McLeod Space Web Middenlaan 47 6865 VN Heveadorp The Netherlands t +31(0)26 3392952 m 06 51 51 89 71 @ info@spaceweb.nl www.spaceweb.nl | Bart McLeod is a Zend Certified Engineer. |
没有评论:
发表评论