[
https://issues.apache.org/jira/browse/OFBIZ-13361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18062084#comment-18062084
]
Florian Motteau commented on OFBIZ-13361:
-----------------------------------------
Hi [~pierresmits],
Thanks for your feedback.
HTML form fields always yield/post strings, and as far as I understand, OFBiz
only way to define how to cast these strings is service definitions, thru
attribute types. This is how a data converter is selected upon form submission,
to cast posted strings to BigDecimal, Timestamp, or other Java classes.
So I would say that if you plan to use a `<text type="range" min="5"
max="10"/>`, you have to define an attribute of type "BigDecimal" on the
service that will handle this form.
So the short answer would be that input type only defines an input method
(front end), and the way we use and store the value after form submission
depends on the developper : we can use a "range" HTML input, but store the
value (eg "2.13") in a VARCHAR, or cast it to a BigDecimal and store it in a
NUMERIC(18,2) depending on how is defined the corresponding service attribute.
This PR just adds new ways to enter 2 kinds of data :
* an hexadecimal color, which will likely be stored as a string
* a numeric value using a range widget (adapted for situations where the exact
value does not matter, but we need to inform th user that it must be in a
specific range), which will likely be stored as a numeric value
Does it make sense ? Or do I miss something here ?
> Form inputs: support more input types
> -------------------------------------
>
> Key: OFBIZ-13361
> URL: https://issues.apache.org/jira/browse/OFBIZ-13361
> Project: OFBiz
> Issue Type: Task
> Affects Versions: Upcoming Branch, 24.09.05
> Reporter: Florian Motteau
> Priority: Minor
>
> Since [https://github.com/apache/ofbiz-framework/pull/862,] OFBiz uses native
> browser validation, and various input types (see
> [https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#input_types).]
> It would be interesting to support other simple input types, such asĀ
> *
> [color|http://example.com|https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/color]
> *
> [range|https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/range]
> The `type` attribute of the `<text/>` form widget is forwarded as a `type`
> attribute on the HTML `<input/>`, so we just have to modify the XSD to accept
> these 2 values. Then we would have to support `min` and `max` attributes to
> be able to use the `range` input.
> The `color` type is juste a convenient input method for hex colors, so we
> just need to update the XSD.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)