I use Yii2 forms and after submit my URL looks like:
http://example.com/recommendations/index?RecommendationSearch%5Bname%5D=&RecommendationSearch%5Bstatus_id%5D=&RecommendationSearch%5Btype%5D=0&RecommendationSearch%5Bcreated_at%5D=&sort=created_at
As you may seem each parameter contains form name RecommendationSearch
. How to remove this RecommendationSearch
from parameters in order to get URL url like the following:
http://example.com/recommendations/?name=&status_id=&type=0&created_at=&sort=created_at
You need to override formName()
in your RecommendationSearch
model to return empty string:
public function formName() {
return '';
}