newhck / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
GNU General Public License v3.0
0 stars 0 forks source link

Checkbox value array strong typing #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When you try to give an array of values to the checkbox method, it does
type checking. 

Line 1395:
if((!is_array($ele->attributes["value"]) && $ele->attributes["value"] ==
$ele->options[$o]->value) || (is_array($ele->attributes["value"]) &&
in_array($ele->options[$o]->value, $ele->attributes["value"], true)))
                                $str .= ' checked="checked"';

If you look just at this part: 
in_array($ele->options[$o]->value, $ele->attributes["value"], true)

The true parameter makes in_array only return true if the types are the same.

Should we turn this off? Maybe there is a good reason for it to be turned
on that I didn't think of.

Original issue reported on code.google.com by moncojhr@gmail.com on 20 May 2010 at 3:38

GoogleCodeExporter commented 8 years ago
I noticed that this same type of syntax is also in the select, rating, and 
checksort elements.  I don't really have a 
good answer as to why this was done initially.  I will remove and do a bit of 
testing to make sure it's not going to 
cause any problems.  Thanks for bringing this up.

- Andrew

Original comment by ajporterfield@gmail.com on 20 May 2010 at 1:50

GoogleCodeExporter commented 8 years ago
This has been removed in the svn working version.

Original comment by ajporterfield@gmail.com on 20 May 2010 at 2:00

GoogleCodeExporter commented 8 years ago
Alright excellent. 

Original comment by moncojhr@gmail.com on 21 May 2010 at 4:35