My application uses a dynamically generated form - therefore I have to use a custom validationXXX() method to validate form input because the field names will change on each request.
There is currently no way to enable the fillin filter for only one single action, if you use a custom validationXXX() method.
The solution:
You have two choices to enable fillin filter:
METHOD 1: add the fillin filter in filters.yml
-> drawback: it will be executed for every action -> overhead)
METHOD 2: create a .yml validation file and enable fillin
- Code: Select all
./validate/xxx.yml:
fillin:
enabled: on
This will throw an exception because symfony looks for a "fields" key.
So I tried:
- Code: Select all
./validate/xxx.yml:
fillin:
enabled: on
fields: []
No error, but also no fillin filter. It's disabled automatically because symfony doesn't find any validation fields.
So the solution is to use a hidden input field:
- Code: Select all
./validate/xxx.yml:
fillin:
enabled: on
fields:
hiddenfield:
required: yes
./templates/myactionSuccess.php:
...
<?php echo hidden_tag('hiddenfield', 1); ?>
...
