Andy,

Are you sure you used $form?   I see this is what you have commented out:

// $(form).before(data.split('!!!')[1]);

That should work if you call it like this:

$form.before(data.split('!!!')[1]);

Note the use of $form instead of $(form).

Based on what you've got in your workaround, this is how I would code
it using ajaxForm:

$('.commentForm form').ajaxForm({
    clearForm: true,
    beforeSubmit: function(arr, $form, opts) {
        var vals = $form.find('[EMAIL PROTECTED],[EMAIL 
PROTECTED]').fieldValue();
        if (!vals[0] || !vals[1]) {
            alert('Both name and comment are required');
            return false;
        }
    },
    success: function(data, status, $form) {
        $form.parent().before(data).prev('.singleComment').slideDown();
    }
});

Mike


On 8/27/07, Andy Matthews <[EMAIL PROTECTED]> wrote:
>
> Yep...
>
> You're welcome to take a look at my final code.
>

Reply via email to