We have a sign-up page that was created in the "List Growth Tools" section of the Web site. We'd like to be able to create a link from our site that will load the sign-up page and automatically check specific boxes (perhaps we'd pass these in via the URL as QueryString options?). Is that a possibility?
Hello,
Thank you for reaching out to the API Support team here at Constant Contact.
There isn't a way to do this built-in to the embedded signup form code directly, however this may be possible by using javascript on your page. Consider something like this:
var i = document.location.href.lastIndexOf('?'); var types = document.location.href.substr(i+1).replace(/list=/g,'').split('&'); $('input[name="listId"]').prop('checked',function(){ return $.inArray(this.value,types) !== -1; });
Consider the url is 'http://mysite.com/signup.html?list=1&list=2'
This would need customization to work with your form's fields and how your URL parameters are set up, but this should get you started in the right direction.
Please let me know if you have any other questions!
Sincerely,
David B.
API Support Specialist
You're right that this didn't work 100% out of the box but it put me on the right track. Apparently on our embed form the checkboxes aren't named 'listId' but this seems to do it:
$(function () { var i = document.location.href.lastIndexOf('?'); var types = document.location.href.substr(i + 1).replace(/list=/g, '').split('&'); $('input[type=checkbox]').each(function () { $(this).prop("checked", $.inArray(this.name.match(/\d+/)[0], types) !== -1) }); });
Thanks so much!