-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Form] fixed allow render 0 numeric input value #10053
Conversation
dczech
commented
Jan 17, 2014
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #10052 |
License | MIT |
Doc PR |
What about the twig template? |
@@ -1,5 +1,5 @@ | |||
<input | |||
type="<?php echo isset($type) ? $view->escape($type) : 'text' ?>" | |||
<?php if (!empty($value)): ?>value="<?php echo $view->escape($value) ?>"<?php endif ?> | |||
<?php if (!empty($value) || is_numeric($value)): ?>value="<?php echo $view->escape($value) ?>"<?php endif ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the condition needed at all? wouldn't value=""
not mean the same as without the attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is that is_numeric
does not cover the case of value=""
but value="0"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i asked why we dont remove the if condition completely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IE doing weird stuff for empty option values
@jakzal Twig does not consider |
@ALL stof explained all doubts, thx |
Good catch, thanks @dczech. |
This PR was merged into the 2.3 branch. Discussion ---------- [Form] fixed allow render 0 numeric input value | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10052 | License | MIT | Doc PR | Commits ------- 82f98c4 [Form] fixed allow render 0 and 0.0 numeric input values
I would appreciate if the comparison was for "0" instead of doing an |
I considered this option too but in this case I had to assume that form_widget_simple couldn't get integer value. It was safer to use |