views:

28

answers:

2

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;
    });

}
A: 

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
}
Kevin
thanks -- but something else is going on. i can add the function between script tags right above the form and still no luck. i tried both function declaration techniques you mentioned
eriksays
If you put an alert right after if(Drupal.jsEnabled), does it appear? Is that condition true?
Kevin
A: 

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.

eriksays