• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
form_open attributes string bug

#1
[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>';
// I did add
// data-foo=\''.json_encode($foo_array).'\'
// to the above tag but code parser has stripped it out.

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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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