• Resolved carnagelp

    (@carnagelp)


    I have created a date field and have set its min and max hours as 4&7 and min and max minutes as 00 and 11.
    See screenshot here: https://ibb.co/SBwbWjC

    However, in the form, while the hours drop down list is working properly i.e showing me only 4 to 7. The minutes dropdown is still showing 00 to 59.
    See screenshot here: https://ibb.co/Z12vVWp

    How to fix this to show only 00 to 11 in the minutes section?

    PS: How do I remove the default (HH:mm) from the label? It gets added on top of the label manually added in the field settings.

    • This topic was modified 3 years, 11 months ago by carnagelp.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @carnagelp

    Yes, that’s correct. You can select from 4:00 to 7:11. For this reason, the minutes are not disabled. You can select 5:30,6:59,etc. But if you select 7:12,7:13, etc., you will see an error message indicating the invalid date.

    If you want to disable all minutes from 12, to 59, you can insert an “HTML Content” field in the form with the following piece of code as its content:

    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery('.minutes-component option').each(function(){
    var e = fbuilderjQuery(this);
    if('11' < e.val()) e.remove();
    });
    });
    </script>

    To hide the date/time format from the field’s label, you can enter the style definition below into the “Customize Form Design” attribute in the “Form Settings” tab:

    
    #fbuilder .dformat{display:none !important;}
    

    Best regards.

    Thread Starter carnagelp

    (@carnagelp)

    Gotcha. Both of these have given the desired results. Thanks!

    Just one more question regarding the date/hours/minutes field:
    Suppose I want to retrieve the numbers selected in HH:MM into a field as a numeric value such that I get: (hh x 12)+mm; how do I do that?

    For example: If 5:02 has been selected; I want to retrieve 5 and 02 to be used in an equation where the result is: (5×12)+02 = 62

    Plugin Author codepeople

    (@codepeople)

    Hello @carnagelp

    You can use the CDATE operation to extract the date components.

    For example, assuming the date/time field is the fieldname1, you can implement the equation in the calculated field as follows:

    
    SUM(CDATE(fieldname1,'h')*12,CDATE(fieldname1,'i'))
    

    Best regards.

    Thread Starter carnagelp

    (@carnagelp)

    I pasted the code above exactly as is except for changing the fieldname and the answer comes out as “90” which is fixed regardless of what input I select in the date field

    Thread Starter carnagelp

    (@carnagelp)

    Upon checking the results of each individual CDATE operation; I found that:

    CDATE(fieldname1,’h’) results in a fixed value of 05
    and
    CDATE(fieldname1,’i’) results in a fixed value of 30

    Hence the result: 90

    And no change in either hour or minutes in the date field is making any change in the above.

    Plugin Author codepeople

    (@codepeople)

    Hello @carnagelp

    Send me the link to your form to check your code in action.

    Best regards.

    Thread Starter carnagelp

    (@carnagelp)

    https://www.fitgirls4life.com/testing-calculators/?nocache=1

    Select “Imperial” under the ‘Unit System’ dropdown to show the HH:MM field.

    The result is shown in the field directly below it.

    Plugin Author codepeople

    (@codepeople)

    Hello @carnagelp

    Please, untick the checkbox: “Use predefined value as placeholder” in the settings of the Date/Time field fieldname5.

    Best regards.

    Thread Starter carnagelp

    (@carnagelp)

    That did it. Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Max minutes setting not working in Date field’ is closed to new replies.