Reputation: 4957
Doing a search form in PHP YII in which i need to enter 2 dates field Startdate and enddate, after submitting i will be fetching all the records from table where the contacteddate falls between these start and end date.
The problem is after submitting my textbox values are vanishing. How to retain after submitting?
Upvotes: 2
Views: 1569
Reputation: 17478
You could use ajax to retrieve the results, instead of the default submit, that way your filter values will not change. The default submit behavior loads(navigates) to a url, hence your values disappear.
You can use CHtml::ajaxSubmitButton()
to easily implement this functionality. A sample:
echo CHtml::ajaxSubmitButton(
'AjaxSearch', // label
$url,// url that will search
array('update'=>'#resultdiv'),// the element with id 'resultdiv' will be updated with the search result
$htmlOptions
);
Upvotes: 1