For my component Example I define the form fields in components/com_example/models/forms/example.xml
<field name="time"
type="time"
label="COM_EXAMPLE_TIME_LABEL"
/>
This will be rendered like:
<input type="text" name="time" />
I was expecting to see
<input type="time" name="time" />
After searching in Joomla code (libraries/joomla/form/fields
and libraries/src/Form
) I've found out that type=time does not exist yet in our codebase.
It would be great if it is possible to use type=time in Joomla.
<input>
elements of type time create input fields designed to let the user easily enter a time (hours and minutes, and optionally seconds).The control's user interface will vary from browser to browser. Support is good in modern browsers, with Safari being the sole major browser not yet implementing it; in Safari, and any other browsers that don't support
<time>
, it degrades gracefully to<input type="text">
.
text copied from: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time
First step was to create this issue, next step is to create a PR. :-)
More information about input type=time can be found on w3.org
https://www.w3.org/TR/2012/WD-html-markup-20120315/input.time.html
Labels |
Added:
?
|
Status | New | ⇒ | Information Required |
Category | ⇒ | Fields |
for note: it also require to do fallback script,
because it has bad support by a browsers https://caniuse.com/#feat=input-datetime
@Fedik no coded fallback needed. As mentioned in the quote from mozilla.org it will gracefully degrades to <input type="text">
on Safari and other browsers that don't support <time>
.
When I look at caniuse I see 86.66 % Global support. I cannot say that it means bad support
As mentioned in the quote from mozilla.org it will gracefully degrades to on Safari and other browsers that don't support
that you will try to explain for further issue reports: "the time field do not display time input", or "time input ignore min/max attribute"
but personally I do not mind, I just point on potential issue
Labels |
Added:
?
|
New Features go only in j4 as i know, so this should get a J4-Issue-Label.
@infograf768 can you please add j4-Label?
Labels |
Added:
?
|
Category | Fields | ⇒ | Feature Request Fields |
Labels |
Added:
J3 Issue
|
Labels |
Added:
?
Removed: J3 Issue ? |
I am working on this. Which files should be changed to add a new field type?
@VladikB You would have to add a new file named TimeField.php
here: https://github.com/joomla/joomla-cms/tree/4.0-dev/libraries/src/Form/Field
You can have a look at the other fields to see how they work.
Okay, thanks, got it. And I how do I get the min, max and step attributes to work and checkt them out?
Take a look here: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Form/Field/NumberField.php there we also support min, max and step :)
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-09-06 15:11:11 |
Closed_By | ⇒ | franz-wohlkoenig |
If it is for J4 we can use the html5 patterns