Can I pre-populate a form field via URL argument?

Options

Our organization would like to set up a page with a picture of the 50 states that a user can click on and be taken to a page that has a dropdown pre-populated with the name of the state that was clicked (this will go in the constituent's "advocacy" field). However, I can't seem to make it pre-populate via URL argument even though I located the field ID in the HTML source and manually put it in the URL in the form of field_name=argument. Is there a way to do this?

Tagged:

Comments

  • Luminate calls these 'URL Setters' on donation forms.

     

    https://www.blackbaud.com/files/support/helpfiles/luminate-online/help/luminateonline.html#Concepts/Admin_Online_Giving_Management_DonationForms_HiddenInputs.html?Highlight=url%20setter

     

    "...and be taken to a page that has a dropdown pre-populated with the name of the state that was clicked..."

     

    What form are you planning on using on this page? Is this going to be a survey? I don't think url setters are built into surveys. You could do this with some javascript in a caption field.

  • Brian Mucha:

    Luminate calls these 'URL Setters' on donation forms.

     

    https://www.blackbaud.com/files/support/helpfiles/luminate-online/help/luminateonline.html#Concepts/Admin_Online_Giving_Management_DonationForms_HiddenInputs.html?Highlight=url%20setter

     

    "...and be taken to a page that has a dropdown pre-populated with the name of the state that was clicked..."

     

    What form are you planning on using on this page? Is this going to be a survey? I don't think url setters are built into surveys. You could do this with some javascript in a caption field.

    Yes, this is a survey. I've created a custom drop-down for the user to select a state, but we'd like it to have the state they've selected from the previous page. How might I use javascript to handle this?
  • Lars Cade:
    Yes, this is a survey. I've created a custom drop-down for the user to select a state, but we'd like it to have the state they've selected from the previous page. How might I use javascript to handle this?

    I knocked out a quick example: http://foundation.luriechildrens.org/site/Survey?ACTION_REQUIRED=URI_ACTION_USER_REQUESTS&SURVEY_ID=4722&state=IL

     

    Here's the code I have in my caption:

     


    <script>

    function querystring(key) {
    var re=new RegExp('(?:\\\\?|&)'+key+'=(.*?)(?=&|$)','gi');
    var r=[], m;
    while ((m=re.exec(document.location.search)) != null) r.push(m[1]);
    return r;
    }

    var tempState = querystring('state');
    if(tempState.length>0)
    {
    $('#1730_4722_1_10162').val(tempState);
    }

    </script>

     

    Note that 1730_4722_1_10162 is the ID of the state field.

  • Hi Folks - this was helpful. I was trying to do something very similar but from a CMS page (form code below) to a Donation Form on LO .


    The form below succeeds in passing the Donation Amount value (radio button) to the Donation Form after clicking the Submit button. However, unable to find documentation to pass on other types of form elements (like fields), their values and non-hidden values. Is there something out there i can view in terms of documentation or anecdotally? Closest thing i found was the link added by Lawrence below in the thread.



    <form action="https://secure.americares.org/site/Donation2" method="get">

                    <input type="hidden" name="df_id" value="12345">

                    <input type="hidden" name="12345.donation" value="form1">

                    <input type="hidden" name="s_src" value="DonationCampaignXX">

            <div class="form-row row-1">

               <div>

                    <input type="radio" name="Level" value="61110" id="class25" />

                    <label for="class25" class="class25 DDinline "><span>$25</span>

                    </label>

                </div>


                <div>

                  <input type="radio" name="Level" value="61111" id="class50">

                  <label for="class50" class="class50 DDinline"><span>$50</span>

                  </label>

                </div>

            </div>


            <div class="form-row row-2">

                <div>

                       <label for="firstname" class="firstname DDinline "><span>Your Name</span></label>

                       <input type="text" name="billing_first_namename" id="first_name" class="DDinline" value="">

                </div>

            </div>


            <div class="form-row row-3">

                <button class="step-button action-button finish-step btn btn-red" type="submit" id="DDbutton" name="pstep_submit">Donate Now</button>

            </div>

    </form>
  • hey there - this approach should work: https://www.blackbaud.com/files/support/helpfiles/luminate-online/help/luminateonline.html#../Subsystems/donation_management/Content/Concepts/Admin_Online_Giving_Management_DonationForms_HiddenInputs.html


    It looks like either the input names are not quite right per the above-linked syntax or something about the form post itself is breaking the URL structure? Perhaps try a different method of directing people to a URL such as http://help.americares.org/site/Donation2?df_id=17060&17060.donation=form1&set.BillingFirstName=Bob


    -Chris

Categories