Support » Plugin: Calculated Fields Form » Datepicker equation with fix date

  • Resolved kovbal79

    (@kovbal79)


    Hi,

    I need help with an equation.
    I would like to get the number of days left in a year with one input date field.
    My equation would be:
    2019.12.31 (this date should be set anywhere fixed, not shown to users) – fieldname1
    fieldname one is a date input from user.
    I set it up this way, but it doesn’t work, probably because of the date format, but don’t know how to set it.
    Thanks in advance!

    kovbal

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @kovbal79

    The simpler solution:

    1. Insert a date field in the form (I’ll assume it is the fieldname2), and enter as its default value: 2019.12.31 (of course, using the same format of the field, if the field format is mm/dd/yyyy, then the date would be: 12/31/2019). As you don’t want this field be visible in the form, enter the special class name: hide through its attribute: “Add CSS Layout Keyword”

    2. Finally, enter as the equation associated to the calculated field the piece of code: ABS(fieldname2-fieldname1)

    and that’s all.

    By the way, the page you sent me as reference does not include any form created with our plugin.

    Best regards.

    OK, thank you! I had it up until the CSS keyword actually, I couldn’t hide the field from the page. And yes, sorry, I didn’t send the full url, but it doesn’t matter anyway now.

    THANK YOU FOR THE QUICK SUPPORT!

    Plugin Author codepeople

    (@codepeople)

    Hello @kovbal79

    It has been a pleasure to help you.

    Best regards.

    Hi,
    One more thing: Now it shows a very weird number until I set the date for ‘fieldname1’, see here: https://konyvelescentrum.hu/kata-es-alanyi-mentes-afa-kalkulator-2020/
    fieldname1 in my case is: “Vállalkozás kezdő napja (yyyy.mm.dd)”
    and the result field is: “Vállalkozás működési napjainak száma 2020-ban”

    Also, I would like to translate yyyy.mm.dd
    Where can I do that? In .po file?

    THanks

    Plugin Author codepeople

    (@codepeople)

    Hello @kovbal79

    To the first question, you simply should to use an “IF” operation to apply the mathematical operations only if both dates where entered by the user. Following the previous example:

    
    IF(AND(fieldname2,fieldname1), ABS(fieldname2-fieldname1), '')
    

    Concerning to your second question, enter the following style definition:

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

    through the “Customize Form Design” attribute in the “Form Settings” tab (https://cff.dwbooster.com/images/documentation/form-settings-tab.png) for hiding the date format from the fields’ labels. And now you can write the text you want as the fields’ labels.

    Best regards.

    Thank you! Great support again!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.