Hi.

I have searched and searched on this one but couldn't find anything that matches my situation exactly: I need to submit form posts to a Marketing Automation company's database using a Javascript-based API function. Because the form is built dynamically using a template file, the site really only has one webform that is then used with about 70 different "thank you/confirmation" nodes, which is why I wanted to process the request on click event, and not on the confirmation page.

So I managed to get everything working using JQuery/Javascript on the click event (code within template file that builds the node/form), but the solution failed in Chrome and Safari.

The company (Marketo) says they won't even look into my case until I use something similar to the following:

mktoMunchkinFunction(
   'associateLead',
   {
      Email: '<?php echo $_REQUEST["email"]; ?>',
      FirstName: '<?php echo $_REQUEST["first_name"]; ?>',
      LastName: '<?php echo $_REQUEST["last_name"]; ?>‘
   },
   '<?php echo hash('sha1', 'my-secret-key' . $_REQUEST["email"]); ?>'
);

My problem was, the $_REQUEST variables are not going to be available until AFTER the processing starts, and since there was a mix of Javascript and PHP, I could not use the above in the "Additional Processing" section, so I came up with the following and put it in the template file that builds the page for this node type:

<script>
$(document).ready(function() {
	
		$('#webinar-form form').validate( {
			rules: {
				"submitted[email]": "email"
			}
		});
	
		$('#edit-submit').click(function() {

			var valid = $('#webinar-form form').valid();
			if(valid) {
								
				mktoMunchkinFunction
				(
					'associateLead',
					{
						Email: $('#edit-submitted-email').val(),
						FirstName: $('#edit-submitted-first-name').val(),
						LastName: $('#edit-submitted-last-name').val()
					},
					sha1Hash('myhashvalue'  + $('#edit-submitted-email').val())
				); 
			}
		}); 
	}); 
</script>

So, does anyone have a recommendation as to how to use $_REQUEST variables as the company is requesting and not have to go to the 70 nodes (and counting) and add or include the code to pull this off with the sid?

I'm guessing I'll need a module, but some guidelines would be GREATLY appreciated.

Thanks in advanced,

Dan

Comments

quicksketch’s picture

Status: Active » Closed (fixed)

Support for writing custom code is not provided in the Webform issue queue.