I am using the ajaxform () plugin, which is still working well. However, the basic values of my input fields are, and if the user presents just the imprinted form, then I need to clear it before submitting the form before submitting: callback.
In short, I do not know the syntax to check the format input field and submit it as needed. I have an idea which is using it every () method and this .defaultValue, and maybe a false return? But I'm not sure about the details.
Can someone give me an idea? Thank you. So far my code is, its check value () function which I have been with.
$ (document) .ready (function () {// ======== = function ========= function styleform () {$ (' Quick contact labels '). Skip (); $ (' Input [type = 'text'], texture '). AddClass ("idleField") ($ (' Input [type = "text '], textarea'). Focus (function () ($ (this) .removeClass ("idleField"). AddClass ("focusField"); if (this.value == This.defaultValue) {this.value = '';} if (this.value ! = This.defaultValue) {this.select ();}}); $ ('input [type = "text"], textraya') .blur (function () {$ (this) .removeClass ("focusField") AddClass ("idleField"); if ($ .trim (this.value) == '') {this.value = (this.defaultValue)? This.defaultValue: '');}});} // Options Ajaxform () function var option = { Target: '.quickcontact display', // target element (servers) has been updated with server response before submit: checkValues, pre-callback success pre: post // postback callback // other available options: // url: url // override 'action' attribute / type of form: type '' or 'post', override for the 'method' attribute of the form // data type: zero // 'xml', 'script' , Or 'json' (type expected server response) // clearForm: true // Ltapurwk clear all form fields after submitting to // resetForm: true // successful submitting // $. The AJAX options can also be used here, for example: // timeout: 3000}; // Update Ajax functionality to redistribute HTML functions () {// do it again, because it has just changed $ ('form.quickcontact'). Ajaxform (options); StyleForm (); } // Submit the check to prevent the submission of the check for the default values of the form on the check. Check Price () {} //} ==== Logic ===== $ ('form.quickcontact') Ajaxform (option); StyleForm (); });
and my form html:
& lt; Form action = "/ inquiries / add" method = "post" id = "EnquiryAddForm" class = "quickcontact" & gt; & Lt; Input type = "hidden" value = "POST" name = "_ method" /> & Lt; Input type = "hidden" id = "EnquiryVisitorId" value = "276" name = "data [query] [visitor_id]" /> & Lt; Input type = "text" id = "inquiry" "maximum length =" 200 "value =" your name "name =" data [query] [name] "/> gt; input type =" text "id = "EnquiryEmailAddress" maxlength = "200" value = "your email" name = "data [query] [email address]" /> textarea id = "inquiry inquiry" rows = "6" column = "30" Name = "data [inquiries] [check]" & gt; your email address & lt; / textarea & gt; & lt; input type = "submit" value = "OK, I did" /> & lt ; / Form & gt;
Instead of trying to work around those problems, I suggest correcting the cause instead.
Default Do not use the default value as a pseudo label when setting the value & mdash; set default value instead using a
element
Comments
Post a Comment