As you may well know currently cannot pre-populate check boxes (or single select fields for that matter) using field merge's on Eloqua forms in E10.

 

However I have pieced together a sample script which will use a web data lookup to populate these fields.  This example in specific is used to populate subscription preferences.  I will be using this sample as a main component in my class at EE12 this year, but I wanted to share it here first and see if I can get some discussion going or some feedback.  I will be going through this specific example in much more detail at EE12.  And yes.. this is also shameless promotion.

 

This JS code goes on the Eloqua landing page that this form lives on.  Each "field#" is dynamicly assigned by the Eloqua form, so make sure your fields are set and order is set before putting this type of script on your page.  I have left the look up id's in the sample just so you can see what this would look like.  I have also left comment lines in so you could easily see how to add additional lines in.

 

Also this form looks to see if an email address has been merged into the form, and if it has not you are redirected to a different form so you can enter it in and set the Eloqua cookie.

 

Feel free to ask questions, but this script is really just intended to be a code example.

 

Here is the sample:

 

<script type="text/javascript">

    var _elqQ = _elqQ || [];

    _elqQ.push(['elqSetSiteId', 'SITE ID HERE']);

    _elqQ.push(['elqTrackPageView']);

 

    (function() {

        function async_load() {

            var s = document.createElement('script');

            s.type = 'text/javascript';

            s.async = true;

            s.src = '//img.en25.com/i/elqCfg.min.js';

            var x = document.getElementsByTagName('script')[0];

            x.parentNode.insertBefore(s, x);

        }

 

        if (window.addEventListener)

            window.addEventListener('DOMContentLoaded', async_load, false);

        else if (window.attachEvent)

            window.attachEvent('onload', async_load);

    })();

</script>

<script type="text/javascript">

    var SubLookupRunning = true;

    var g1 = '{23849e08-8f50-45b4-8de4-e0ee3c5016f0}';

    var g2 = '{185a974b-99a8-4cb0-a526-80e28afdd2b4}';

    var g3 = '{43ad1ef2-7650-4436-bb8c-c412eba32b4a}';

    var g4 = '{da6628c9-d170-4eec-8cbb-7c5f52e83b80}';

 

    //var g5 = '{4949f39f-ca1b-4621-831c-2750402f3a6b}';

   

var g1Status;

    var g2Status;

    var g3Status;

    var g4Status;

    //var g5Status;

 

    function SetElqContent() {

        g1Status = GetElqGroupMembershipStatus(g1);

        g2Status = GetElqGroupMembershipStatus(g2);

        g3Status = GetElqGroupMembershipStatus(g3);

        g4Status = GetElqGroupMembershipStatus(g4);

    //    g5Status = GetElqGroupMembershipStatus(g5);

 

     SetupForm();

    }

 

    function GetEmailAddress() {

        _elqQ.push(['elqDataLookup', escape('6a948629-09c5-452e-a258-92b96bbf7849'), '<C_EmailAddress>' + document.getElementById('field0').value + '</C_EmailAddress>']);

    }

 

    function SetupForm() {

 

        radioButtons = document.getElementsByName("radioButtons");

        if (g1Status) {

            document.getElementById('field6').checked = true;

            radioButtons[1].checked = true;

 

        }

 

        if (g2Status) {

            document.getElementById('field7').checked = true;

            radioButtons[1].checked = true;

        }

 

        if (g3Status) {

            document.getElementById('field8').checked = true;

            radioButtons[1].checked = true;

        }

 

        if (g4Status) {

            document.getElementById('field9').checked = true;

            radioButtons[1].checked = true;

        }

 

    //    if (g5Status) {

    //        document.getElementById('field5').checked = true;

    //        radioButtons[1].checked = true;

    //    }

    }

 

 

    window.onload = GetEmailAddress;

</script><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script><script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<script type="text/javascript">

    $(document).ready(function() {

 

        if ($("#field0").val() == "") {

            alert("In order to manage your subscriptions, we need to verify your email address by sending you a confirmation email with a link to the Subscription Center.");

            window.location = "URL TO BASIC EMAIL ADDRESS ONLY FORM";

        }

 

        $("#field10").click(function(event) {

            $("#field6").attr('checked', false);

            $("#field7").attr('checked', false);

            $("#field8").attr('checked', false);

            $("#field9").attr('checked', false);

        //    $("#field5").attr('checked', false);

        });

 

        $("#field6").change(function() {

            $('[name="radioButtons"][value="No"]').attr('checked', true);

        });

 

        $("#field7").click(function() {

            $('[name="radioButtons"][value="No"]').attr('checked', true);

        });

 

        $("#field8").click(function() {

            $('[name="radioButtons"][value="No"]').attr('checked', true);

        });

 

        $("#field9").click(function() {

            $('[name="radioButtons"][value="No"]').attr('checked', true);

        });

 

    //    $("#field5").click(function() {

    //        $('[name="radioButtons"][value="No"]').attr('checked', true);

    //    });

    });

 

</script>