• Resolved akitaro

    (@akitaro)


    Hello,

    thank you for creating this amazing plugin.

    I am trying to display only one of the HTML fields based on the value in the calculated field.

    Based on your answer to a similar question on this forum, I’ve tried this

    (function(){
    var result = fieldname9+fieldname10+fieldname11+fieldname12+fieldname13;
    if( result <= 5 ) return ‘fieldname19’;
    if( result <= 10 ) return ‘fieldname20’;
    if( result <= 25 ) return ‘fieldname21’;
    })()

    but doesn’t work for me. I’ve tried to define dependencies but sometimes I would get 2 HTML fields to display.

    What I am trying to achieve is :

    if calculated field = 0 do nothing

    if calculated field <= 5 show fieldname19 HTML content only

    if calculated field <= 10 show fieldname20 HTML content only

    if calculated field <= 25 show fieldname21 HTML content only

    and a second question would be :

    How can I set the button (fieldname17) to be active/clickable only if the Acceptance (GDPR) (fieldname16) is ON ?

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

    (@codepeople)

    Hello @akitaro

    Please edit the equation as follows:

    (function(){
    var result = fieldname9+fieldname10+fieldname11+fieldname12+fieldname13;

    HIDEFIELD(fieldname19|n);
    HIDEFIELD(fieldname20|n);
    HIDEFIELD(fieldname21|n);

    if( result <= 5 ) SHOWFIELD(fieldname19|n);
    else if( result <= 10 ) SHOWFIELD(fieldname20|n);
    else if( result <= 25 ) SHOWFIELD(fieldname21|n);

    return result;
    })()

    Note I used the fields fieldname19|n, fieldname20|n, and fieldname21|n with the |n modifier. The plugin replaces the fields’ names by their values before evaluating the equations. The |n modifier tells the plugin you are referring to the fields’ names directly and not their values.

    Best regards.

    Thread Starter akitaro

    (@akitaro)

    Flawless! Thank you very much.

    About my second question, should I make it a new topic ?

    Plugin Author codepeople

    (@codepeople)

    Hello @akitaro

    I’m sorry, I’ve forgotten the second question.

    The option here would be check the field value as part of the onclick event code.

    For example, assuming the DGPR field is the fieldname1, and you want to display an alert message when the user presses the button and the fieldname1 field is ticked. In this hypothetical example, you can enter the following piece of code as the button onclick event:

    if(getField('fieldname1').val()) alert('the message');

    As the code is in another context (it is not an equation) to access the field value you must call the getField operation to get field’s object, and the val method to get its value.

    Best regards.

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