• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4 Model Return "&" Instead of "&"

#1
How do you prevent the CI4 model from returning "&" instead of "&" when pulling text from the database?  This behavior is desired when I would like to pass data to a view for display, but it is very undesirable when I want to pass data to an input field that is part of an update form view.
Reply

#2
Have you looked in the database how the string is saved? if you use in form a wyswyg, all html are encoded like the "&".
Reply

#3
(09-22-2020, 06:51 AM)nicojmb Wrote: Have you looked in the database how the string is saved? if you use in form a wyswyg, all html are encoded like the "&".

I checked, and it is being saved correctly in the database. However, nicojmb's suggestion prompted me to dig a little deeper. The CI4 model is, in fact, returning "&" and not "&" as it should.  It is the Form Helper's set_value() function that is swapping "&" for "&".  I did not pay close enough attention to the documentation, and did not set the $html_escape flag to FALSE.  All is well now.
Reply

#4
(09-22-2020, 07:30 AM)mlurie Wrote:
(09-22-2020, 06:51 AM)nicojmb Wrote: Have you looked in the database how the string is saved? if you use in form a wyswyg, all html are encoded like the "&".

I checked, and it is being saved correctly in the database. However, nicojmb's suggestion prompted me to dig a little deeper. The CI4 model is, in fact, returning "&" and not "&" as it should.  It is the Form Helper's set_value() function that is swapping "&" for "&".  I did not pay close enough attention to the documentation, and did not set the $html_escape flag to FALSE.  All is well now.

Great!!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.