form validation with onsubmit and js

Hello,

I’m trying to integrate a javascript file with a validation function with the ui-lib functions that generate forms. To do so i create my interface as follows:

[snip] use WebminCore;
my $js = "<script type='text/javascript' src='/virtualmin-myextension/validate.js' ></script>\n";

print header("Mailboxes Configuration", null, undef, undef,0,0,undef, $js);

[snip]

print ui_form_start("","post",undef,
    "onSubmit=\"return check_form_valid()\");

the mailbox.js content is:

function check_form_valid() { alert("hello"); return false; }

the produced HTML code is like this:

[snip] [snip] [snip]

apparently the form validation does not happen (no alert is executed). on the contrary, if I build the form as:
print ui_form_start("",“post”,undef,
"onSubmit=“return alert(‘something’)”);

i can see the alert popup.

the js path seems to be correct, because in firefox i can see the source file and double click in the “src” link of the element “<script src=”/virtualmin-myextension/validate.js’ >" and it loads the correct file.

is it possible I’m missing something?

thanks in advance