you can use integer values as keys and replace them later on with
text. or use strings from the beginning.
On 20 Sep., 01:34, "gregor.morr...@gmail.com"
<gregor.morr...@gmail.com> wrote:
> I'm running into a weird situation where I have three CakePHP-
> generated radio buttons with values "1", "new" and "0" respectively.
> The issue is that when I select the radio button with value "new",
> both it and the one with value "0" are marked as checked after
> submitting the form. (I confirmed this in the generated HTML source).
>
> I did some digging and in cake/libs/view/helpers/form.php, line 1088:
>
> if (isset($value) && $optValue == $value) {
> $optionsHere['checked'] = 'checked';
>
> }
>
> Since this code will compare "new" to 0, it will convert the string to
> an integer first and since 0 == 0, it will be marked as checked.
>
> Now, I rethought my approach and it's fine (probably better?) for me
> to just use the values "current", "new", and "none" for my three radio
> buttons, instead of mixing numbers and a string value. However, I
> wasn't sure if this is a bug that should be reported.
>
> Should that comparison in the code above be more strict, e.g.
> $optValue === $value ?
>
> Thanks,
> gRegor
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment