8000 [Form] isActive choice field not preselected · Issue #1087 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] isActive choice field not preselected #1087

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

Closed
chmielot opened this issue May 25, 2011 · 6 comments
Closed

[Form] isActive choice field not preselected #1087

chmielot opened this issue May 25, 2011 · 6 comments
Labels

Comments

@chmielot
Copy link

When creating an entity with a field 'active' of column type boolean (mysql -> tinyint(1) ) and try to use it in a form as a 'choice' field as radio with these attributes:
'required' => false, 'expanded' => true, 'multiple' => false, 'choices' => array( 0 => 'no', 1 => 'yes'),
the field is never preselected, no matter if value is 0 or 1.

I'd like to attach a test bundle I created for this problem that demonstrates it, but I don't know how.

[edit] Just discovered Gist, hope this helps: https://gist.github.com/990760

@fabpot
Copy link
Member
fabpot commented May 27, 2011

Can you test with the current master. It should be fixed now.

@chmielot
Copy link
Author

I tested it and it's fixed for select box and checkbox. But there is still no preselection for 'multiple' => false and 'expanded' => true, in other words, there is no preselection for radio input.

Hopefully I updated to current master correctly. In my project root I used "git fetch" which updated something and then "php bin/vendors.php" which updated a lot of stuff, too.
Example of git fetch just now:

git fetch
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 8 (delta 3), reused 5 (delta 0)
Unpacking objects: 100% (8/8), done.
From https://github.com/symfony/symfony-standard
69a78d3..78fe692 master -> origin/master
From https://github.com/symfony/symfony-standard

  • [new tag] v2.0.0BETA3 -> v2.0.0BETA3

@chmielot
Copy link
Author

Just tested on another entity, where the table column is a string with the length of 1. If I then use characters for choices, preselection works. So it seems, that it only doesn't work for "integer-choices".

@fabpot
Copy link
Member
fabpot commented Jun 8, 2011

Ok, I'm pretty sure that if works for all cases now. Can you confirm?

@chmielot
Copy link
Author
chmielot commented Jun 8, 2011

Yes I can confirm. Thank you very much!

@chmielot chmielot closed this as completed Jun 8, 2011
@sapna-tj
Copy link

Can any one please help me to preselect a checkbox?.

I just want two checkbox with label 'Yes' and another with 'No', the 'Yes' checkbox should be preselected.

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

No branches or pull requests

3 participants
0