Support » Plugin: Calculated Fields Form » Random fields

  • Resolved johnny7075


    Hi there,
    Is it possible to display random fields with the radio buttons?
    I can designate which fields to show when a button is selected but not a random field or series of random fields.

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


    Hello @johnny7075

    You can activate/deactivate random fields from the equations.

    For example, assuming you have four fields, fieldname1, fieldname2, and fieldname3, and you want to activate one of them and disable the rest, after the user selects an option of radio buttons or checkbox field fieldname4.

    The fields’ names are hypothetical, and used only to describe the process.

    Insert a calculated field in the form and enter the following equations:

    var list = [fieldname1|n, fieldname2|n, fieldname3|n],
        index = FLOOR(RANDOM() * list.length);
      for(var i in list) {
        if(i==index) ACTIVATEFIELD(list[i]);
        else IGNOREFIELD(list[i])

    And that’s all.

    Note I used some fields’ names with the |n modifier. The plugin replaces the fields’ names in the equations with their corresponding values, but the |n modifier tells the plugin you want to use the fields’ names and not their values.

    Best regards.

    Thread Starter johnny7075


    Thanks for the super fast response!

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