• Resolved mike33

    (@mike33)


    hi!

    How to set “selected” attribute to DROPDOWN form control via GET request? may be you have any solution)?

    Thanks!

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

    (@codepeople)

    Hello @mike33

    I’ll try to describe the process with an example. Assuming the get parameter is: my_param and the the DropDown field you want pre-populate is the fieldname1, in this case:

    First, insert into the page the shortcode for the variable:

    
    [CP_CALCULATED_FIELDS_VAR name="my_param" default_value=""]
    

    Second, insert a javascript block in the page’s content to define the default value of the field:

    
    <code style="display:none;"><script>
    cpcff_default = { 1 : {} };
    cpcff_default[1][ 'fieldname1' ] = my_param;
    </script></code>
    

    Finally, insert the form’s shortcode.

    More information about the variables’ shortcodes, and how to define the default fields’ values, visiting the following links:

    https://cff.dwbooster.com/documentation#javascript-variables
    https://cff.dwbooster.com/documentation#populate-form

    and that’s all.
    Best regards.

    Thread Starter mike33

    (@mike33)

    Awesome! thanks!

    Best regards.

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

The topic ‘Dropdown form control’ is closed to new replies.