Re: Pre-select radio button based on link clicked in email

Anonymous
Not applicable

Pre-select radio button based on link clicked in email

I have an email with 2 links (request a demo, have sales contact me) that both go to the same form. On that form, the user can pick one of two radio buttons (request a demo | have sales contact me) that align to those 2 links. Is there any way to preselect the radio buttons on the form based on which link the user clicks in the email? Or would we be better off having 2 forms, one for each option?
Tags (1)
4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Pre-select radio button based on link clicked in email

Very simple -- pass the value in the query string (?preselect=1 or ?preselect=2) and set the value when the form loads.
SanfordWhiteman
Level 10 - Community Moderator
Jim_DiModica
Level 3

Re: Pre-select radio button based on link clicked in email

Sanford -

I tried coding the link to the form page as you indicated in an attempt to pre-select one of the form's radio buttons. Didn't work. I notice that this script is in your page. Do I need it? If so, how to configure it if my radio buttons field is API Name: dateEvent  /  Friendly Label: Date-Event  ?

<script>MktoForms2.loadForm("//app-sj01.marketo.com", "410-XOR-673", 159,
function(form){
  var precheckedCategory = getQV('Category');
  form.setValues({
  Category__c : precheckedCategory
  });
  form.getFormElem()[0].className+=(' rendered');
});
</script>

SanfordWhiteman
Level 10 - Community Moderator

Re: Pre-select radio button based on link clicked in email

You certainly need the form load script.  You also need the script from the JS pane at MktoForms2 :: QS Preselect Radio

For your fields:

form.setValue({

  dateEvent : precheckedDateEvent

});

then include &precheckedDateEvent=<whatever> in the URL.