Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Modifying a form value in form_fields() doesn't get saved

edited May 2014 in News & Announcements

I simply want to use htmlspecialchars_decode on the content field value before the form is rendered, though this does not work:
function form_fields($values)
$fields = parent::form_fields($values);

if(!empty($values['content'])) {
$fields['content']['value'] = htmlspecialchars_decode($values['content']);

return $fields;

I need to do this as when I save a bunch of HTML in a field, it gets removed. How can I stop this from happening?



  • edited 4:23PM
    The reason why is because, it gets overwritten with a call to Form_builder::set_field_values() method which usually contains the values of the models find_one_array. You can specify an "edit_method" for you module in your MY_fuel_modules.php file which would run htmlspecialchars_decode on your content value however, it may be easier to use a "pre_process" function like so:
    $fields['content']['pre_process'] = 'htmlspecialchars_decode';
Sign In or Register to comment.