Custom Fields in Marketo Forms | Community
Skip to main content
January 28, 2013
Question

Custom Fields in Marketo Forms

  • January 28, 2013
  • 7 replies
  • 1403 views
Are custom fields able to complete calculations when a box is selected in a form?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

7 replies

January 28, 2013
A formula field type can set a value based on the value of another field (i.e. checkbox), but there are no calculations available.
January 29, 2013
Look at what Marketo customer vCom solutions did with their calculator here - http://info.vcomsolutions.com/TelecomCalculator.html
January 29, 2013
Any ideas on how to do that, or a tutorial or article that would be helpful in creating something similar?
January 29, 2013
The from is done in Marketo. There is some type of script on the page. I am not a programer so it is hard for me to be descriptive. You could look at the source code for the landing page, that is where I would start.
January 30, 2013
I'm willing to bite on an interesting use case. In this example the form is a standard Marketo form, and on the follow up page they've added a bit of jQuery to customize the results. (replaced *script* with ***** in order not to break the community)

<****** type="text/javascript">
    // use no conflict mode for jQuery
  var $jQ = jQuery.noConflict();

  $jQ(document).ready(function() {

var dspend; 
var spendval=1;
var daudit;
var auditval=1;
var dloc;
var locval=1;
var dcarrier;
var carrierval=0;
var dinvoice;
var invoiceval=0;



var spend= $jQ('#Monthy_Telecom_Spend').attr('value');
if (spend == 1) { dspend = 'Less Than $10,000'; spendval=25;}
if (spend == 2) { dspend = '$10,001-$25,000'; spendval=20;}
if (spend == 3) { dspend = '$25,001-$50,000'; spendval=20;}
if (spend == 4) { dspend = '$50,001-$10,000'; spendval=15;}
if (spend == 5) { dspend = 'Greater than $100,000'; spendval=15;}
$jQ("#dspend").text(dspend); 


var audit= $jQ('#Date_of_Last_Telco_Audit').attr('value');
if (audit == 1) { daudit = 'Less than 1 year'; auditval=50;}
if (audit == 2) { daudit = '1-3 years'; auditval=80;}
if (audit == 3) { daudit = 'More than 3 years'; auditval=100;}
$jQ("#daudit").text(daudit); 


var loc= $jQ('#NumberOfLocations').attr('value');
if (loc == 1) { dloc = 'Less than 10'; locval=0;}
if (loc == 2) { dloc = '10-50'; locval=3;}
if (loc == 3) { dloc = 'More than 50'; locval=6;}
$jQ("#dloc").text(dloc); 


var carrier = $jQ('#Num_Carriers_Managed').attr('value');
if (carrier == 1) { dcarrier = '1-5'; carrierval=17280;}
if (carrier == 2) { dcarrier = '6-10'; carrierval=23040;}
if (carrier == 3) { dcarrier = 'More than 10'; carrierval=34560;}
$jQ("#dcarrier").text(dcarrier); 


var invoice= $jQ('#Num_Invoices_Managed').attr('value');
if (invoice == 1) { dinvoice = '1-10'; invoiceval=11520;}
if (invoice == 2) { dinvoice = '11-25'; invoiceval=23040;}
if (invoice == 3) { dinvoice = '26-50'; invoiceval=34560;}
if (invoice == 4) { dinvoice = 'More than 50'; invoiceval=46080;}
$jQ("#dinvoice").text(dinvoice); 

var savings= (spendval* (auditval/100)) + locval ;
$jQ("#savings").text(Math.round(savings)); 
 
var cost = carrierval + invoiceval ;
var strCost=cost.toString();
strCost=strCost.substring(0,2) +","+strCost.substring(2) ;
$jQ("#cost").text(strCost); 


  });
</******>Great example of using math on a landing page!!! Well done Sierra. PS- to vCOM, you're not using Google Analytics!
January 30, 2013
Thanks Adam! I will have to ask why they are not! I am sure there is a reason!
Jep_Castelein2
Level 10
January 31, 2013
Nice solution! Please note that the thank you page has a pre-filled form, which is where the JavaScript is reading the values from. If they wanted, they could use CSS to hide the form on the thank you page. 

Jep