• Resolved irving.bos

    (@irvingbos)


    looking for way to populate a drop down field with values found elsewhere on the page . I assume it would be via JavaScript which I am totally comfortable with. Any specific process to follow?

    thanks

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

    (@codepeople2)

    Hello @irvingbos

    Thank you so much for using our plugin. Yes, that’s possible. You need only to call the setChoices method in the DropDown field. For example, if the DropDown field is the fieldname123, you can insert an HTML Content field in the form, tick the checkbox in its settings to support scripts, and enter a script block in its content similar to:


    <script>
    fbuilderjQuery(document).on('formReady', function(){
    getField('fieldname123').setChoices({texts:['text choice 1', 'text choice 2', 'text choice 3'], values:['value choice 1', 'value choice 2', 'value choice 3']});
    });
    </script>

    The getField operation returns the field’s object. The parameter of the setChoices method is an object with the texts and values properties whose values are the array of choices’ texts and values, respectively.

    Best regards.

    Thread Starter irving.bos

    (@irvingbos)

    thanks! I will give that a try.

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

You must be logged in to reply to this topic.