Closed (fixed)
Project:
HTML5 Tools
Component:
Strategy
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2010 at 14:43 UTC
Updated:
16 Sep 2010 at 03:50 UTC
I have been looking at implementing the input type=number field for all CCK Number Fields for HTML5_Form_Tools.
I ran into this dilemma though and vaguely remember discussing it at Drupal Camp NYC. Do we give users the option to select an extra "Textfield type number" in CCK? Or do we override all type Integer/Float/Decimal form fields in a hook_form_alter ?
Last night I was looking at the arrays that drupal_render uses to render these "number textfields", and it was a little more complicated than just changing the type.
Append CCK or just override anything we see in $form that's type => number?
Comments
Comment #1
jensimmons commentedI just made mew components for HTML5 Tools. Switching this to "Strategy."
Comment #2
LSU_JBob commentedAfter discussing this I think we're leaning towards the latter.
We want something to happen immediately once the module is turned on. If we only provide the end user with the ability to select the widget when making new fields with CCK, we're in theory telling them that they have to go back to all of their content types and change the widget type.
I'm gonna see if I can find the best way to just override any "number textfield". Not going to change number dropdowns or radios/checks.
Comment #3
bleen commentedsubscribing
Comment #4
LSU_JBob commentedI've set up my D6-17 dummy site on my local server with a bunch of devel generated pages. I've added a required CCK integer field to the content type, and devel has provided values for me. When I edit the node, the integer value appears in an element. I want that type to turn from "text" to "number." The CCK field name is field_page_integer.
In the html5 tools module I've used just a regular hook_form_alter to find out if there are any integer fields on the page.
From this point on though I'm confused on what to do. I've discovered the integer and it's ID. But the actual element on the page is id="edit-field-page-integer-0-value-wrapper". I would just tell jQuery to look for "edit-"+ field_name + "-0-value-wrapper" but I feel like that would just be a hack and not a real solution to this.
How do I get into the function that renders this element and also be sure I'm changing the right one when I change the type from "text" to "number?" Yargh!
Comment #5
bleen commentedLSU_JBob:
We havent made the elements module a dependency of html5_tools yet, but we plan to. That module will handle the HTML form fields
Comment #6
ericduran commentedYea, Also There's still discussions over at #816090: Support HTML5 elements regarding the elements and their names. Right now most of the elements got into the elements module but there's still issues regarding the names and problems with other modules that use the same names for elements.
Sadly we can't really start changing fields into the issue is resolve.
Comment #7
LSU_JBob commentedJust saw a presentation by ericduran and this seems to be in the module now! Nice!
Comment #8
ericduran commentedYeah, sorry about that. This was fixed in this patch. http://drupal.org/cvs?commit=408228
Comment #9
ericduran commented