Reputation: 140
using drupal with lightbox2 to open a form. this form is from a custom module.
the module has a setting: 'onsubmit' => 'return form_submission(this);' and that appears to be working correctly.
I've included the functions.js in the theme.info file and it's showing up, i can open that file and see the function.
for some reason, i keep getting "form_submission not a function" when i do submit the form.
if(Drupal.jsEnabled)
{
$(document).ready(function() {
// Call back function for AJAX call
var form_submission = function(responseText) {
alert (responseText);
}
// preventing entire page from reloading
return false;
});
}
Upvotes: 2
Views: 394
Reputation: 11
Your form_submission function is local to the anonymous function it's inside (ie the document ready function).
You need to declare the function in a global scope, outside of the document ready. You at least need to declare the variable form_submission. You will then be able to attach the function on to it wherever you wish.
Upvotes: 1
Reputation: 140
Not that this is the perfect answer, but I removed the function from within the document.ready jquery wrapper and it picked up on it.
Upvotes: 0
Reputation: 13226
form_submission has to be a defined function.
function form_submission(data) {
// action code
}
or also try
var form_submission = new function(data) {
// action code
}
Upvotes: 0