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

checkboxgroup_abstract.php类中对radio值的判断问题 #126

Open
GoogleCodeExporter opened this issue Apr 15, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

出现的问题是在导入表单数据时,当radio值为0时无法设为check
='true',通过新增语句
                if(is_int($value) && empty($selected)){
                    $selected = (int)$selected;
                }

新增上述语句后,radio值为0时可正常选取。

原代码:
        foreach ($items as $value => $caption)
        {
            $checked = false;
            if($type == 'checkbox')
            {
                 if (!is_array($selected))
                 {
                     $selected = array($selected);
                 }
                 if (in_array($value,$selected))
                 {
                     $checked = true;
                 }
            }
            else
            {
                if ($value == $selected && strlen($value) == strlen
($selected) && strlen($selected) > 0)
                {
                    $checked = true;
                }
            }

更新后代码为:

        foreach ($items as $value => $caption)
        {
            $checked = false;
            if($type == 'checkbox')
            {
                 if (!is_array($selected))
                 {
                     $selected = array($selected);
                 }
                 if (in_array($value,$selected))
                 {
                     $checked = true;
                 }
            }
            else
            {
                if(is_int($value) && empty($selected)){
                    $selected = (int)$selected;
                }
                if ($value == $selected && strlen($value) == strlen
($selected) && strlen($selected) > 0)
                {
                    $checked = true;
                }
            }


Original issue reported on code.google.com by xiaohua1...@gmail.com on 4 Dec 2009 at 5:14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant