Hi,
I accidentally removed an email I got today about this, and I do not recall who send it to me, so I cannot reply to this person. I'm sorry about that, and I hope you can see this feature request, so you can chime in if necessary.
The idea was to change a few bits of the current implementation of this module to make it easy to use Formatted Numbers at FormAPI level. Nice.
Well, I believe it is currently impossible because: a) dependency on content_field() and b) the FAPI element needs to be constructed with all the stuff that CCK puts in place.
To use Formatted Numbers at FormAPI level, we would have to move all code dependent on CCK to formatted_number_widget() and keep FAPI dependent code as agnostic as possible. This includes formatted_number_elements(), formatted_number_widget_process() and probably the field formatters (theme functions).
Unfortunately, I do not have time right now to work this out, so I'll keep this feature request as postponed until I can find a hole, or someone else can come up with a patch, which is more than welcome.
Comments
Comment #1
markus_petrux commentedComment #2
markus_petrux commentedI do not know why I switched the project, but this feature should be implemented by Format Number API. We need a 'numeric' form element, not within the scope of CCK, which is what Formatted Number CCK solves, so I'm going to work on this...
I guess I need to take over a new name for a FAPI element... note that 'formatted_number' is taken by the CCK related module, and I do not want to enforce more version dependencies between both modules, so I need to use a different name for the FAPI element, however 'number' is also taken by the CCK Number field (CCK2 and Fields in D7), so I need something different... 'numeric' maybe? hmm... it looks good, and it seems to me no one else is using this name. ¿?
Related discussion at g.d.o: http://groups.drupal.org/node/37522
Comment #3
markus_petrux commentedBetter title, and patch coming...
Comment #4
markus_petrux commentedCommitted to CVS :)
http://drupal.org/cvs?commit=295986
Comment #5
markus_petrux commentedUgh... this is not ready yet. Numbers with decimals are not properly formatted in FAPI stuff. Will look into it as soon as possible.
Comment #6
markus_petrux commentedWell, I think it is now done. I have committed to CVS a fix for our element process and value callbacks.
http://drupal.org/cvs?commit=296174
Comment #7
markus_petrux commentedYet another follow up to fix the logic behind the #size and #maxlength attributes of the input element.
http://drupal.org/cvs?commit=296182