I tried to implement a search-function in the First Application.
After submitting in the search-form the URL index.php?SearchUserForm[username]=test&yt0=Search looks right, but the defaultpage will be loaded.
class SearchUserForm extends CFormModel
and the action:
public function actionSearch()
//$userList=$form->search(); for debugging
what have i missed?
if(isset($_GET['Search'])) //this is true if your search button is named 'Search', right?
More: 'username' must be listed as 'safeAttribute'…
sorry, no change.
Yes my button is named 'Search'
I added safeAttribute in user model, right?
public function safeAttributes()
For me, it seems that yii doesn't recognise the part behind '?' in the URL
Why are you checking for 'Search', I think you should check for 'yt0', no?
This is because the query part (after the question mark) in your form action URL is discarded if the form is submitted using GET method.
You need to store existing GET parameters (in particular the 'r' parameter which stores the route) in hidden fields so that when the form is submitted, these GET parameters are restored.