We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

use persistent->parameters for setting tag defaults

Hi, I've an ajax search form, (searchable table headers), after having the form submitted, response load results + new search fields. To populate them with the submitted values, I'm using in my controller

$parameters = $query->getParams;
$this->persistent->parameters = $parameters;

$this->tag->setDefault("city",$parameters['bind']["city"] );

and

now if I made a query on city field with caracter "a" as search key, "%a%" is displayed in the input field for city.

Is there a better way to do what I want (and without escaping these %...%)



98.8k
Accepted
answer

You can save the $_POST data instead of the processed criteria parameters:

$this->persistent->parameters = $this->request->getPost();
$this->tag->setDefault("city",$parameters["city"] );


43.8k

Easy ! Thanks phalcon.