Protected attributes on forms
This is an open discussion with 2 replies, filed under General.
Search
Can I achieve something similar with Symphony?
Not in Symphony 2. This functionality is coming in S3 though (one day). One saving grace is that a user would have to know the name of the field to set.
I usually customise my Event to force the $_POST variable. In the generated event __trigger
or load
method (in the event PHP file) add:
$_POST['fields']['is-moderated'] = 'your-default-value';
Then set allowEditorToParse
to false
to prevent you re-saving the event through the Symphony UI thereby saving over this customisation.
Thanks Nick. That’s done the trick.
Create an account or sign in to comment.
I have a section with a checkbox field called is_moderated.
This field is only used by moderators through the Symphony admin interface. It’s not included on the website’s form, which posts to an event.
If I was feeling cheeky, I could craft a form which set is_moderated to ‘1’ from the website form.
In Rails, I can set the attribute as ‘protected’ to prevent the field being updated through mass assignment. Can I achieve something similar with Symphony?