Closed (fixed)
Project:
Webform
Version:
7.x-3.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
15 Apr 2009 at 17:43 UTC
Updated:
11 Jun 2012 at 19:53 UTC
Jump to comment: Most recent file
Comments
Comment #1
quicksketchNew features are being added to the 3.x version only. I've closed the following issues as duplicates:
#586342: Time increment
#338449: Is it possible to customise the time field?
Comment #2
cbearhoney commentedWas this feature added to the 6.x-3.x-dev version? That's the one I have but I don't see any options for increments. Instead I changed the time.inc file to this:
It works, but when a user selects '00' minutes the value is blank in the e-mail. Any idea why?
Comment #3
kthullI don't know about writing patches, but I'm loving the fix suggested in #2. I didn't check the email output, but viewing the webform results shows the double zero in my D6.20 install with Webform 6.x-3.6.
Any chance this can get rolled into dev if it's not already there?
Comment #4
quicksketchWe need a more extensive fix than just hard-coding the minutes in 15 minute increments. We'd need an option when configuring time components to set the increment. I'd be happy to look at patches, but this issue is not a high priority for me.
Comment #5
arlanda commented+1 for this feature via the user interface!
Comment #6
pbosmans commentedAlso +1 for this feature via the user interface!
Comment #7
johan den hollander commented+1 subscribing...
Comment #8
drclaw commentedThought I would take a stab at this one. Seemed pretty straight forward. Overview of the patch:
- Adds a setting on the time field page to select the minute increments (1, 5, 10, 15,30)
- Validates that the default time's minutes is a multiple of the increment setting
- Uses the minute increment settings to populate the time component options properly on the webform itself
Patch is for 7.x-3.x-dev but should be easily back ported to d6.
Hope it's helpful!
Comment #9
drclaw commentedOops... Sorry, just realized that the patch was for version 3.x-3.9-hotfix. Here's one that will apply to the 7.x-3.x-dev branch. Apologies!
Comment #10
quicksketchNice one @drclaw! I'll review when I get a chance.
Comment #11
drclaw commentedLooking forward to it. =)
Comment #12
Maestro232 commentedI definitely need the patch but I'm running D6. Can I apply this same patch?
Comment #13
drclaw commentedI'm not sure if this will apply to the d6 version... Maybe give it a try and see what happens? Otherwise, it's a small patch and should be fairly easy to backport...
Comment #14
quicksketchI'm taking a look at this code now. Overall it looks and works great! It'll need a little bit of tweaking to help make it easily compatible with Form Builder (we'll change the validation function to be on the minuteincrements form element, rather than on the entire form).
Comment #15
quicksketchHere's a patch which takes a slightly different approach:
- Instead of validating the default value, it will simply round the default value to the next valid minute. This bothers the user less and solves problems with using dynamic times, such as "now" as the default value.
- Removed some legacy and cruft code.
- Removed redundant description/help texts.
- Switched to using a FormAPI attribute for #minuteincrements, to make it easily compatible with Form Builder.
Patch seems to apply to D6 and D7 just fine, so no porting necessary. How does this approach sound to you @drclaw?
Comment #16
drclaw commentedNice! I just gave it a whirl and it works perfectly! I like what you did with the time rounding. It works well. =)
Thanks!
Comment #17
benjifisherI do not have time to test (meeting in 10 minutes...) but I looked at the patch.
I suggest replacing this with
A few lines later, I see
Again, I do not have time to test, and I do not have the context, but it looks as though the test should be
Comment #18
quicksketchThanks @benjifisher, both excellent suggestions. Let's refactor and test again.
Comment #19
benjifisherMy second suggestion was half-baked. The code that I quoted is wrapped in
so it should not matter whether you test for strict inequality or not (
>or>=).I was not sure how to test the code, so I just set the increment to 5 minutes and added
to the code. It works. My minute field was set to '05'. I did some further testing, and 23:58 gets rounded up to 12:00 pm as expected.
I have attached a patch. The only difference from the one in #15 is my first suggestion from #17.
Comment #20
benjifisherSorry, I did not mean to mark my own patch RTBC.
Comment #21
drclaw commentedCool. Looks good. Just tested it out with no issues. Great suggestion btw. ;-)
Comment #22
quicksketchThanks guys! Tested again and works great. Committed to both 3.x branches of the project. Teamwork ftw!
Comment #24
scott m. sanders commentedWe would like an option to increment hourly -- in this case, we would probably not need a minutes dropdown at all, just add ":00" to all of the hour options, or as plain text after.