Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Radio inputs generated by Tag::radioField have checked-attribute if value is 0. #947

Closed
philippgerard opened this issue Jul 28, 2013 · 3 comments

Comments

@philippgerard
Copy link

Generating radio inputs with Tag::radioField yields the following behavior:

<?php

use Phalcon\Tag;

echo Tag::radioField(array(
    'test',
    'value' => 1,
    'checked' => 'checked'
));
echo "\n";
echo Tag::radioField(array(
    'test',
    'value' => 0
));

Output will be:

<input type="radio" value="1" checked="checked" name="test" id="test" />
<input type="radio" value="0" name="test" id="test" checked="checked" />

Output should be:

<input type="radio" value="1" checked="checked" name="test" id="test" />
<input type="radio" value="0" name="test" id="test" />

Tested with latest source from 1.2.2 branch.

Best wishes,
Philipp

@philippgerard
Copy link
Author

Generating the radio buttons yourself using

    public static function radioField($params)
    {
        return self::_inputField('radio', $params);
    }

solves the issue. So I guess there's some faulty "magic" happening in radioField.

@dreamsxin
Copy link
Contributor

Tag::radioField is Automatically check inputs. I try fix it.
Compare error:

if (PHALCON_IS_EQUAL(current_value, value)) {

phalcon pushed a commit that referenced this issue Jul 30, 2013
Fix bug #947 Tag::radioField Automatically check
@phalcon
Copy link
Collaborator

phalcon commented Aug 3, 2013

Fixed in 1.3.0, thanks

@phalcon phalcon closed this as completed Aug 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants