form_open attributes string bug - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: form_open attributes string bug (/showthread.php?tid=52147) |
form_open attributes string bug - El Forum - 05-31-2012 [eluser]Unknown[/eluser] The form_open helper function doesn't cope with json_encoded data. When adding custom data-x attributes to any element, my understanding is that it's quite usual to use single quotes and to json encode the value because json_encoded data will have double quotes in it. Code: $html = '<a href="/">Bar</a>'; The form_open helper function accepts an array of key=>value pairs for adding attributes to the form tag. It double-quotes all values in the resulting string which breaks custom data attributes like this. There is a workaround of passing a string instead of an array but that's clearly more cumbersome than using an array. Is there any possibility or need to alter the helper function such that it either single-quotes data attributes or checks for quotes in the value and switches where necessary. |