Hi All Same question.
form.submit is not a function form.submit(); Works fine without "file upload field". I didnt understand about files.php. What is inside this file? my form is something like <form method="post" id="myForm" class="cssform" action="../submitajax.php"> <input type="hidden" value="<?php print $user->uid; ?>" name="uid"/> <input type="hidden" class="ts" value="" name="ts"/> <input type="hidden" value="100000" name="MAX_FILE_SIZE"/> <input type="text" id="product" name="product" /> <input type="text" id="quant" name="quant" /> <input type="text" id="invoice" name="invoice" /> <textarea id="descr" name="descr" rows="5" cols="35"></textarea> <input type="file" name="file"/> <input type="hidden" name="mimetype" value="html" id="uploadResponseType"> <input id="submit" type="submit" value="Next Step" /> </form> My script is <script> // prepare the form when the DOM is ready $(document).ready(function() { var options = { target: '#output1', // target element(s) to be updated with server response beforeSubmit: showRequest, success: showResponse // post-submit callback // other available options: //url: url // override for form's 'action' attribute //type: type // 'get' or 'post', override for form's 'method' attribute //dataType: null // 'xml', 'script', or 'json' (expected server response type) //clearForm: true // clear all form fields after successful submit //resetForm: true // reset the form after successful submit // $.ajax options can be used here too, for example: //timeout: 3000 }; // bind form using 'ajaxForm' $('#myForm').ajaxForm(options); $('#myForm').ajaxForm( { beforeSubmit: validate } ); $('#myForm').ajaxForm({ beforeSubmit: function(a,f,o) { o.dataType = $('#uploadResponseType').val(); $('#uploadOutput').html('Submitting...'); }, success: function(data) { var $out = $('#uploadOutput'); $out.html('Form success handler received: <strong>' + typeof data + '</strong>'); if (typeof data == 'object' && data.nodeType) data = elementToString(data.documentElement, true); else if (typeof data == 'object') data = objToString(data); $out.append('<div><pre>'+ data +'</pre></div>'); } }); }); function validate(formData, jqForm, options) { // jqForm is a jQuery object which wraps the form DOM element // // To validate, we can access the DOM elements directly and return true // only if the values of both the username and password fields evaluate // to true var form = jqForm[0]; if (!form.title.value || !form.tag.value) { alert('Please enter a value for'); return false; } alert('Both fields contain values.'); } // pre-submit callback function showRequest(formData, jqForm, options) { // formData is an array; here we use $.param to convert it to a string to display it // but the form plugin does this for you automatically when it submits the data var queryString = $.param(formData); // jqForm is a jQuery object encapsulating the form element. To access the // DOM element for the form do this: // var formElement = jqForm[0]; alert('About to submit: \n\n' + queryString); // here we could return false to prevent the form from being submitted; // returning anything other than false will allow the form submit to continue return true; } // post-submit callback function showResponse(responseText, statusText) { // for normal html responses, the first argument to the success callback // is the XMLHttpRequest object's responseText property // if the ajaxForm method was passed an Options Object with the dataType // property set to 'xml' then the first argument to the success callback // is the XMLHttpRequest object's responseXML property // if the ajaxForm method was passed an Options Object with the dataType // property set to 'json' then the first argument to the success callback // is the json data object returned by the server alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.'); } </script> <script> $(document).ready(function(){ $('.warning').remove(); $.get("../../../token.php",function(txt){ $(".ts").attr({ value: txt }); }); }); </script> 2007/11/4, Mike Alsup <[EMAIL PROTECTED]>: > > > > I have similar problem, but when I'm trying to upload a file an error > > occurs, saying: > > > > "opts.success is not a function" > > > You're using jQuery v1.0.4. The Form Plugin requires v1.1 or later. > > Mike > -- Prezado(a)s Sr(a)s Atenciosamente, Mário Alberto Chaves Moura [EMAIL PROTECTED] Av. Raja Gabaglia, 4859 / 209 Belo Horizonte MG 30360670 31-3264-6203 31-9157-6000