CI 3 form helper add new lines after form_element |
Hi there,
In CI 2, the following code PHP Code: echo "before" . form_input("test") . "after"; Code: before<input type="text" name="test" />after Code: before<input type="text" name="test" /> 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
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?
|
Welcome Guest, Not a member yet? Register Sign In |