• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI 3 form helper add new lines after form_element

#1
Hi there,
In CI 2, the following code
PHP Code:
echo "before" form_input("test") . "after"
Used to return :
Code:
before<input type="text" name="test" />after
In CI 3, it returns :
Code:
before<input type="text" name="test" />
after

It may be a feature, but it's a bug to me, as I use it in javascript string, and javascript doesn't like new line in the middle of a string.

Thanks
Reply

#2
While you can quite easily setup a MY_form_helper to prevent the newline outputs, you should be passing the output through a function (like json_encode(), for example) to ensure the output is safe to use in a JavaScript string. For an example of why this might be important, what would happen to your code if the output of form_input() used single quotes instead of double quotes?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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