Skip to content

[BUG]: Radio button does not recgonized '0' as a valid value, stays unselected #16416

@zhangster

Description

@zhangster

A radio button that worked in previous versions is now broken. I tried some new hack i found for Phalcon 5 used for check boxes to see if it'll work, and it goes less broken but it still won't register 0 as a value;

render("dt_id", array("value"=>'0', "onclick"=>"updateDiscussion(this.value);")); ?>No Discussion

**(note that it doesn't matter if 1 is a string or not, it will always register)

render("dt_id", array("value"=>1, "onclick"=>"updateDiscussion(this.value);")); ?>All Discussions

in the Forms object:

    $dt_id = new Radio('dt_id');
    if (!is_null($entity)) {
        echo $entity->dt_id;
        $dt_id->setAttribute('checked', strval($entity->dt_id));
    }
    $this->add($dt_id);

You guys really need to fix this. I think the code thinks 0 is the same as false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Implemented

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions