Individual submit button text
-
Hi,
I’m wondering if it’s possible to have different submit button text for each form? Since the purpose of each of our forms are different, it makes sense for use to have a different action message on the submit button. I can’t find anything in the built-in options to do this. Are there any workaround for this?
Much thanks in advance!
Charles Ma
http://wordpress.org/extend/plugins/salesforce-wordpress-to-lead/
-
Not at present. You could use jQuery to change the submit button value.
I’ll add it to the wish list for future versions.
Hi Nick,
Thanks for the tip. I’m not too familiar with coding, so can you direct me to how I can use jQuery to accomplish this? I hope this won’t take take up too much of your time. But I’m sure other users will want to know about this.
By the way, when do you expect a next release? (ballpark date would be good for me). =)
Thanks!
CharlesPlace the relevant portion of the snippet below either the form short code (in HTML mode, not Visual mode), or in an empty text widget at the bottom of the sidebar containing the SF widget (if your theme styles empty widgets, use an option below).
If your theme has a spot to put javascript in the footer, you can use that as well.
Or, use this plugin to add the script to the relevant pages:
http://wordpress.org/extend/plugins/css-javascript-toolbox/<script> // Shortcode jQuery("#salesforce_w2l_lead_1 .w2linput.submit").val("Your Text Here"); //Widget jQuery("#salesforce_w2l_lead_1_sidebar .w2linput.submit").val("Your Text Here"); </script>
Change the 1 to the ID of the form you’re targeting. Copy and paste lines to target multiple form IDs.
RE: Next release – no date set yet.
Hi Nick,
I just tested the code you provide and it worked perfectly! I want to thank you again for the awesome plug-in, and even better support!
I’m extended your code to capture ip address of the form submitter by using:
jQuery("#salesforce_w2l_lead_1 .w2linput#sf_IP_Address__c").val("<?php echo $_SERVER['REMOTE_ADDR']; ?>");
This works great.
But now I want to get even more fancy. I want to add form submitter region in the form.
I’m using this code I found online:<script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> function geoTest() { if (google.loader.ClientLocation) { var latitude = google.loader.ClientLocation.latitude; var longitude = google.loader.ClientLocation.longitude; var city = google.loader.ClientLocation.address.city; var country = google.loader.ClientLocation.address.country; var country_code = google.loader.ClientLocation.address.country_code; var region = google.loader.ClientLocation.address.region; var text = 'Your Location<br /><br />Latitude: ' + latitude + '<br />Longitude: ' + longitude + '<br />City: ' + city + '<br />Country: ' + country + '<br />Country Code: ' + country_code + '<br />Region: ' + region; } else { var text = 'Google was not able to detect your location'; } document.write(text); } geoTest(); </script>
But I can’t seem to call the function nor the variables using:
jQuery("#salesforce_w2l_lead_6 .w2linput#sf_Region__c").val(geoTest());
Love to hear your suggestions. And I hope my code above can help others.
Thank you,
CharlesAlright! I think I solved it! Here are the code if anyone is interested:
<script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> function geoTest() { if (google.loader.ClientLocation) { var latitude = google.loader.ClientLocation.latitude; var longitude = google.loader.ClientLocation.longitude; var city = google.loader.ClientLocation.address.city; var country = google.loader.ClientLocation.address.country; var country_code = google.loader.ClientLocation.address.country_code; var region = google.loader.ClientLocation.address.region; jQuery("#salesforce_w2l_lead_1 .w2linput#sf_city").val(city); jQuery("#salesforce_w2l_lead_1 .w2linput#sf_state").val(region); jQuery("#salesforce_w2l_lead_1 .w2linput#sf_country").val(country_code); } else { var text = 'Google was not able to detect your location'; } } geoTest(); jQuery("#salesforce_w2l_lead_1 .w2linput#sf_IP_Address__c").val("<?php echo $_SERVER['REMOTE_ADDR']; ?>"); </script> <script>
It works ok on PCs, but it’s not working on my iphone. So I think it’s a problem with Google’s api.
That means that your phone’s IP can’t be geolocated using that API (it’s likely only for fixed IPs where they know roughly where each IP is actually allocated – e.g. home or business broadband).
If you were on wifi I’d guess it’d work, but not on 3G/4G. You can ask for their location via JavaScript but that requires the pop-up authorization on iOS (“this website would like yo use your current location”).
- The topic ‘Individual submit button text’ is closed to new replies.