• Resolved ste9ste

    (@ste9ste)


    Hello, first of all, thanks to the developers for this helpful plugin.

    I’d like to ask for a little help. Essentially, I’m reading a value from a parameter in the URL ‘X’ and I would like this parameter to be selected in my dropdown.

    [cf7-recordset id="read" type="url-parameters"]
    
    [cf7-link-field recordset="read" field="X" value="" text="X"]
    
    [select* X "1" "2" "3"]
    
    // URL EXAMPLE  https://www.example.com/?X=1

    The plugin correctly reads the value and selects the correct value in my dropdown, but it removes all the other values. I would like to automatically read and select the value from the parameter but leave the option for the user to change it by opening the dropdown.

    I hope I have explained it correctly. Thanks in advance. Have a great day at work.
    Stefano

    • This topic was modified 1 year, 5 months ago by ste9ste.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @ste9ste

    The [cf7-link-field] tag populates the field with the information obtained from the [cf7-recordset] tag. But it is not what you want. You don’t want to populate the field only to select a choice.

    So, in this case, you should use the plugin events.

    [select* X "1" "2" "3"]
    [cf7-recordset id="read" type="url-parameters"]
    <script>
    document.addEventListener('cf7-recordset', function(evt){
    if(evt.detail['recordset-id'] == 'read') {
    jQuery('[name="X"]').val(evt.detail['recordset-data'][0]['X']);
    }}); </script>

    Best regards.

    Thread Starter ste9ste

    (@ste9ste)

    Thank you very much for creating this plugin and for being available to help people customize it. Your support is greatly appreciated.

    Plugin Author codepeople

    (@codepeople)

    Hello @ste9ste

    Thank you very much.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Read url from parameter to dropdown’ is closed to new replies.