In -webkit browsers (the only ones that support number input type at the moment), no matter the base input type, it only allows for integers. This is because the default step value for type=number is 1, when it needs to be set to the precision of the field. See http://code.google.com/p/chromium/issues/detail?id=74120 for details as to what I'm talking about. This really needs to be changed in order to be useful.

CommentFileSizeAuthor
#4 add_precision_information_as_step.patch750 bytesBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ericduran’s picture

Yea, I thought we fix this. A while ago :-/

ericduran’s picture

Category: task » bug
Priority: Normal » Critical

Hmm, I haven't look into this yet. But I'm pretty sure we pass in the presicion of the field when being used in field ui. Don't we?

Moving this to critical since is the only bug we have open.

Snugug’s picture

I haven't looked at this in a while, but will double check to make sure that isn't actually what's going on.

Berdir’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
750 bytes

Can confirm that this isn't working.

That's how the field looks for us:

<input type="number" id="edit-field-lng-de-0-value" name="field_lng[de][0][value]" value="7.2955328000" size="19" maxlength="17" min="-180.00" max="180" class="form-text form-number"&gt>

Looking at _numberfield_html5_tools_field_widget_form(), it does use the precision to calculate #size and #maxlength but nothing else.

Attaching a patch that seems to work for me. The value for scale 10 then actually looks like 1.0E-10 but that seems to be accepted by Chrome at least. Stepping down works fine, Stepping up is somehow borked, but that might be Chrome's problem (it works for 2-3 steps but then simply stops, no matter what the value is).

ericduran’s picture

Status: Needs review » Fixed

Thanks Everyone.

This is now fixed with proper commit credit.

--
http://drupalcode.org/project/html5_tools.git/commit/39d8e8b

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.