CakePHP生成一个链接,其参数参数由select输入确定

Say I am on a view on my Cake app. E.g. http://myapp.com/controller/action/argument

I am aware of generating a link with the HtmlHelper like so:

echo $this->HtmlHelper->link( 'Link title', array('controller' => 'mycontroller', 'action' => 'myaction', $parameter) );

Now, say I have a dropdown select box with a load of options in it. What's the best way to have the link use the value in the select box as the parameter for the action? Would I need to use jQuery to change the link upon dropdown change?

You should wrote the CakePHP link as more generic as you can, so using a jQuery function like that:

function displayVals() {
    var src = $( "#sel" ).val();
    $('#link').attr('href',src);
}

and a HTML part like that:

<form action="../">
<select id="sel" name="myDestination">
    <option value="http://www.yahoo.com/">YAHOO</option>
    <option value="http://www.google.com/">GOOGLE</option>
</select>
</form>
<a href="" id="link">click</a>

your result will be something similar to this this fiddle.

yes you can do this by using jquery

just use html script block for getting the script inside your html.

echo $this->Html->scriptBlock("
    $('#yourSelectBoxId').change(function() {
        var url = '". $this->Html->url(array(
            'controller' => 'mycontroller', 
            'action' => 'myaction', $parameter
        )) ."'; // just setting your url like this.
        // you can proceed further with url 
    })
")