[jQuery] Unbind form submit after it has been submitted

[jQuery] Unbind form submit after it has been submitted


Hi! I'm using the jQuery form plugin ( http://malsup.com/jquery/form/
).
I have a form with this fields:
<form id="insertcomment" action="insertcomment.php" method="post">
<textarea name="bodytext" cols="50"></textarea><br />
<input type="submit" id="submitme" name="submit" value="Submit" />
And this script:
$('#insertcomment').ajaxForm({
target: '#commentoutput',
beforeSubmit: unbindlink,
success: function() {
$('#commentoutput').fadeIn('slow');
}
});
function unbindlink(formData, jqForm, options) {
var form = jqForm[0];
if (form.bodytext.value == ""){
return true;
}
else
$('#submitme').unbind();
}
I'm trying to unbind the click event on the submit button, to avoid
the same comment being posted twice.
$('#submitme').unbind(); is just the last try, I tried some other
things such as $('#insertcomment').unbind('submit'); with no luck...
How do I do that?
Also, as you see I'm checking some submitted values and if they're
empty the PHP script will say so and it wont unbind the submit, so
that user can correct their errors.
I'm going through PHP because I'm using gettext to output
multilanguage warnings and I don't wanna set it up for js too. Being
form.bodytext.value the value of my textarea, how do I check for its
length?
I tried with if (form.bodytext.value.length > 500) or also .size, they
dont work...
Sorry for the length of this post! Thanks