• Resolved saralanda

    (@saralanda)


    Hi,

    I have a dropdown with values “1”,”2″,”3″…”20″.

    I am sending a parameter in the url with the desired value between 1 & 20.

    How do I assign that value to the dropdown?

    Thank you.

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

    (@codepeople)

    Hello @saralanda

    Thank you very much for using our plugin.

    I’ll try to describe the process with a hypothetical example.

    Assuming the URL parameter is v=1, or v=5, etc. and the dropdown field is the fieldname1. You can insert an “HTML Content” field in the form and enter the following piece of code as its content:

    <script>fbuilderjQuery(document).one('showHodeDepEvent', function(){
    getField('fieldname1').setVal(getURLParameter('v', ''));
    });</script>

    Best regards.

    Thread Starter saralanda

    (@saralanda)

    Thanks for your quick response.

    I copied the script and pasted it in an “HTML Content” field below the dropdown field.

    The dropdown is named fieldname1.

    This is the url https://tulumcharters.com/test/

    You can see a short video of what the form settings look like: https://www.loom.com/share/f92762861de448eab42b478752459ec2

    It is still not working. Not sure what i’m doing wrong.

    Thanks for your help

    • This reply was modified 2 years, 8 months ago by saralanda.
    • This reply was modified 2 years, 8 months ago by saralanda.
    • This reply was modified 2 years, 8 months ago by saralanda.
    Plugin Author codepeople

    (@codepeople)

    Hello @saralanda

    My apologies, there is a typo in my code, the correct is:

    <script>fbuilderjQuery(document).one('showHideDepEvent', function(){
    getField('fieldname1').setVal(getURLParameter('v', ''));
    });</script>

    Please, after replacing the code in the “HTML Content” field, please, visit your URL with the v parameter:

    https://tulumcharters.com/test/?v=3

    Best regards.

    Thread Starter saralanda

    (@saralanda)

    It works! Thank you

    Thread Starter saralanda

    (@saralanda)

    Hi again,

    The js script above works well when there is only 1 cff on the page. However, when there is more than 1 cff, it only works for the first one, even though I pasted the script in all forms.

    https://tulumcharters.com/test/?v=3

    How can I make it work for multiple forms on the same page?

    Thank you

    Thread Starter saralanda

    (@saralanda)

    Nevermind, I fixed it by writing getURLParameter(‘v’, ”) in a calculated field in each form.

    Plugin Author codepeople

    (@codepeople)

    Hello @saralanda

    Thank you very much for sharing your solution.

    Best regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Use utm parameter as default value for dropdown’ is closed to new replies.