I have the following URL rule in config/main:
'urlManager'=>array(
//'appendParams' => true, // I've tried it without success.
'urlFormat'=>'path',
'rules' => array(
// other rules...
'experience/search/<param:\w+>' => 'experience/searchExperiences',
I use a form with the GET
method and I expect it to produce a URL like this:
http://site.dev/experience/search/Viseu
But what I get is:
http://site.dev/experience/search?searchText=Viseu
--
This is the form part:
<form action="/experience/search" method="get" class="search-form">
<div class="cell">
<?php
$this->widget(
'zii.widgets.jui.CJuiAutoComplete',
array(
'id' => "search-text",
'name' => "searchText",
'options' => array(
'minLength' => '3',
),
'source' =>
'js: function(request, response) {
getSuggestions(request, response);
}',
)
);
?>
</div>
--
How could Yii be set up to do that?
Rule used: 'experience/search/<param:\w+>' => 'experience/searchExperiences',
JavaScript code added on submit:
$('#form-search').submit(function(event) {
var searchText = $('#search-text').val();
$('#form-search').attr("action", '/experience/search/' + searchText);
});
Changed the form's method to POST
:
<form id="form-search" action="/experience/search" method="post" class="search-form">
I will still wait for any better suggestion.