Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
'&' (ampersand's) in Form Input fields
  • Using the form class to create an input field, i.e. Form::Input(), ampersands (&'s) are converted to & amp; Does anyone know of a way to get around this or is there a reason that ampersands are used? Say I'm entering information in the database is there not a way to see it how i entered it? Does what I said even make sense? I'm pretty bloody tired! PS the function that transforms values for an input is in Fuel\Core\Form::prep_value(); Having wrote this far I thought i'd throw in a screenshot for you: before saving to DB:
    http://d.pr/QCzS after retrieving from DB:
    http://d.pr/ktNM
  • Ben Corlett wrote on Sunday 29th of May 2011:
    Using the form class to create an input field, i.e. Form::Input(), ampersands (&'s) are converted to & Does anyone know of a way to get around this or is there a reason that ampersands are used? Say I'm entering information in the database is there not a way to see it how i entered it? Does what I said even make sense? I'm pretty bloody tired! PS the function that transforms values for an input is in Fuel\Core\Form::prep_value(); Having wrote this far I thought i'd throw in a screenshot for you: before saving to DB:
    http://d.pr/QCzS after retrieving from DB:
    http://d.pr/ktNM

    In the documentation for Views look up '$auto_encode' when set to false it won't filter with htmlentries.
  • I've turned the encoding off altogether in my views however this is unrelated to that. The value you give to the form input is manipulated in the form class I was wondering if anyone has a workaround aside from not using the form class?
  • [EDITed: I changed this just now in the dev branch to work better] Use a form.php config file or set this after you've loaded the form class but before rendering the form:
    Config::set('form.prep_value', false);
    

    And it shouldn't be encoded anymore.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion