 
					
				
		
 
					
				
		
I solved some big things in my email preference center in forms2.0, by using the Forms2.0 Javascript API. http://developers.marketo.com/documentation/websites/forms-2-0/
Based on the fields populated I added a script to manipulate the data. I have added the code below, for anyone interested.
<script>
    //Written by Diederik Martens (C) 2014
    MktoForms2.whenReady(function (form){
        //check for unsubscribe at any change
        form.onSubmit(function(){
            //get the form field values
            var vals = form.vals();
            //if all unchecked > unsubscribe
            if(vals.ePCNews == "No" && vals.ePCEvents == "No" && vals.ePCContent == "No" && vals.ePCLogistics == "No" && vals.ePCProduction == "No" && vals.ePCWorkforce == "No" && vals.ePCSCPO == "No" && vals.ePCSOP == "No") {
                form.vals({"Unsubscribed":"true"});
                form.vals({"Email_Opt_in__c":"false"});    
            } else {
            //something (type or topic) is still checked so we keep opt-in
                //any of the 3 types is still checked
                if(vals.ePCNews == "Yes" || vals.ePCEvents == "Yes" || vals.ePCContent == "Yes") {
                    //check if any topic is also check
                    if(vals.ePCLogistics == "Yes" || vals.ePCProduction == "Yes" || vals.ePCWorkforce == "Yes" || vals.ePCSCPO == "Yes" || vals.ePCSOP == "Yes") {
                        //at least 1 topic is checked so don't interfere. but do record optin
                        form.vals({"Unsubscribed":"false"});
                        form.vals({"Email_Opt_in__c":"true"});    
                    } else {
                        //none of the topics are checked, whilist at least 1 type is checked. so check all topics by default
                        form.vals({"Unsubscribed":"false"});
                        form.vals({"Email_Opt_in__c":"true"});    
                        form.vals({"ePCLogistics":"Yes"});
                        form.vals({"ePCProduction":"Yes"});
                        form.vals({"ePCSCPO":"Yes"});
                        form.vals({"ePCSOP":"Yes"});
                        form.vals({"ePCWorkforce":"Yes"});                        
                    }
                }
                //none of the 3 types are checked
                else {
                    //check if any topic is checked.
                    if(vals.ePCLogistics == "Yes" || vals.ePCProduction == "Yes" || vals.ePCWorkforce == "Yes" || vals.ePCSCPO == "Yes" || vals.ePCSOP == "Yes") {
                        //at least 1 topic is checked, whilist no type is checked, lets keep the person opt-in, but which type to check? check all.
                        form.vals({"Unsubscribed":"false"});
                        form.vals({"Email_Opt_in__c":"true"});    
                        form.vals({"ePCNews":"Yes"});
                        form.vals({"ePCEvents":"Yes"});
                        form.vals({"ePCContent":"Yes"});
                    } else {
                        //no topics are checked, and no types are checked, so opt-out
                        form.vals({"Unsubscribed":"true"});
                        form.vals({"Email_Opt_in__c":"false"});    
                        form.vals({"ePCNews":"No"});
                        form.vals({"ePCEvents":"No"});
                        form.vals({"ePCContent":"No"});
                        form.vals({"ePCLogistics":"No"});
                        form.vals({"ePCProduction":"No"});
                        form.vals({"ePCSCPO":"No"});
                        form.vals({"ePCSOP":"No"});
                        form.vals({"ePCWorkforce":"No"});
                    }
                }
            }        
            var valszz = form.vals();
            //alert("Submitted values: " + JSON.stringify(valszz));
        });
    });
</script>
 
					
				
		
