• Resolved johnzoro

    (@johnzoro)


    i might be asking basic questions

    i want to create a calculator

    initially I want 2 fields

    1 date entered and another where the result is a date

    so let’s say jan 1st is the date in the first field, then the calculator would add on 30 days then display the result which would be a date in the second field.

    i would also like to give the user 2 options

    so (option a) 30 days or (option b) 60 days and they select one

    another thing would be I would like to eventually have different styles

    so say red would be 30 days, blue would be 40 days, green would be 50 days etc etc

    but I would add that on later.

    does this make sense?

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @johnzoro

    Thank you very much for using our plugin.

    I’ll try to answer your questions with a hypothetical example.

    Assuming you have the date field, fieldname1, and a radio buttons field (the fieldname2) with two choices, whose values are 30, and 60, respectively.

    – Insert a calculated field in the form (I’ll assume its name is fieldname3) and enter the equation:

    CDATE(fieldname1+fieldname2, 'mm/dd/yyyy');

    – If you want to modify the result color based on the choice selected, you could edit the equation as follows:

    (function(){
    var color = IF(fieldname2 == 30, 'red', 'green');
    getField(3).jQueryRef().find('input').css('color', color);
    return CDATE(fieldname1+fieldname2, 'mm/dd/yyyy');
    })()

    The getField operation receives the number component in the field’s name (in the example, the number 3) and returns its object representation.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘new form’ is closed to new replies.