• Resolved rjes

    (@rjes)


    Hi, could anyone tell me what is the simplest way to display a text field based on more complex conditional logic? I can easily do it based on one variable, for example a selection from a dropdown by using ‘If selected show fieldname7’. However, I have messages which I need to display depending on more complex logic than that. For example

    (function(){
    if (fieldname4 == “Bay Window bus” && (fieldname6 == “1968” || fieldname6 == “1969” || fieldname6 == “1970” || fieldname6 == “1971”)) some code to make a text field appear;
    })()

    I am not sure whether there is a feature built in to do this, which I have not found, or whether it should somehow be done by

    I am using this for data validation – to prevent users entering invalid combinations from multiple dropdowns.
    I believe a message can probably be inserted based on conditional logic by inserting HTML somehow, but controlling the display of a text field suits my requirement better. Some of the messages I would like to display are quite long (they explain to the user why what they have selected is invalid), so I would ideally like to use the conditional logic to display whether a text field displays or not because of how they can be made to appear a 2 lines with scroll arrows, to a long message doesn’t take up lots of space.
    I have searched this forum, and scrolled through 35 pages of it, but not found anything directly relevant. Thank you.

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

    (@codepeople)

    Hello @rjes

    Thank you very much for using our plugin. The plugin includes two operations pairs IGNOREFIELD/ ACTIVATEFIELD and SHOWFIELD/HIDEFIELD.

    The SHOWFIELD/HIDEFIELD operations pair shows and hides fields, but they do not affect their values or submissions. The INGOREFIELD/ACTIVATEFIELD operations pair shows and hides the field and additionally ignores them from the equations and submissions, or activates them in both.

    Assuming you have the field fieldname123 and want to ignore or activate it based on complex conditions. The equation can be implemented as follows:

    (function(){
    if (fieldname4 == "Bay Window bus" && IN(fieldname6, [1968, 1969, 1970, 1971])) ACTIVATEFIELD(fieldname123|n);
    else IGNOREFIELD(fieldname123|n);
    })()

    Please, note I used the |n modifier with fieldname123.

    The plugin replaces the fields’ names in the equations with their corresponding values. The |n modifier tells the plugin you want to use fieldname123 as the field name.

    Best regards.

    Thread Starter rjes

    (@rjes)

    Thank you. This works perfectly.

    I have a lot more learning to do, but I am very impressed with this plug-in so far.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Display text field based on conditional logic’ is closed to new replies.