I have a very simple Webform with a single field: email.

When the user clicks the submit button, I need to use AJAX to call out to to a web service that processes that email and returns a JSON object with the results.

I need to populate a 'Thank You' page with information based on that JSON object.

I know how to use AJAX to call out to the web service and I know how to parse the result. What I do not know is how to dovetail this functionality into Drupal/Webform.

I am confused by the instructions found here: www.drupal.org/node/342183

Thanks in advance for all suggestions.

Comments

quicksketch’s picture

Status: Active » Closed (fixed)

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

clf99’s picture

Issue tags: +JavaScript, +onsubmit

me too.
How do i make javascript run in my onsubmit. it works on apache but when i put the same code in drupal it is ignored. e.g.

<form name="webPost" 
       action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" 
       method="POST" 
       onsubmit="return ValidateForm()">
... lots of other crap ...
</form>

On our existing site, the code works fine. On the new, recently drupalized site, ValidateForm() is never executed, as I can
see by sticking an alert in there or using firebug. One of the things this routine does is validate that the email address
they give us in the form doesn't suck when they're downloading free stuff from us.

Surely there's just some flag in drupal somewhere you flip that says, "stop screwing w/ my javascript" right?

what is it?

if it's more complex than that, what's the philosophy behind why it's done that way?

please help? feel free to call me on cell at 5127753809 if you know the answer. thanx!

d8v15’s picture

Issue summary: View changes

I know this was 6 years ago, but the original question was not asking for custom code help. It was asking which hook to use for calling javascript AFTER the valid information is submit.

Up to this point, I still dont see which hook to use. Everyone seems to be using it on click, etc - which is incorrect.