>  I am trying to get the value of a name field - below is part of the form
> and the JS

Tim,

First, don't use ajaxForm and ajaxSubmit together.  Pick one or the
other.  ajaxForm is almost always the best one to choose.

Try this:

<html>
<head>
<script type="text/javascript" src="jquery-1.1.1.js"></script>
<script type="text/javascript" src="jquery.form.js"></script>
<script type="text/javascript">

$(document).ready(function(){
    var options = {
        url: "/contactusSubmit",
        type: 'post',
        beforeSubmit: validate,
        success: contactCompleted
    };

    $('#contactForm').ajaxForm(options);
});

function validate(data, $form, opts) {
    var name = $('#contactForm [EMAIL PROTECTED]').fieldValue();
    alert(name);
    if (!name) return false;
}

function contactCompleted(responseText, statusText){
    // do stuff
}

</script>
</head>
<body>
    <form name="contactForm" id="contactForm" action="" method="post">
        Your Name<br />
        <input type="text" name="name" />
    </form>
</body></html>

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to