View Full Version : jQuery Help with form validation

11-25-2009, 05:37 PM

I have set up all my fields to validate with php and ajax using the jquery library.

The php array returned is
$response = array(
'ok' => true or false,
'msg' => "message about ok or why failed"

The is correctly printed next to the corresponding input box. Now i would to check to make sure that they all returned ok = true when the form is submitted. However i am new to javacript and ajax and dont know where to begin.

javascript function

var validateUsername = $('#validateUsername');
$('#username').keyup(function () {
var t = this;
if (this.value != this.lastValue) {
if (this.timer) clearTimeout(this.timer);
validateUsername.removeClass('error').html('<img src="../images/ajax-loader.gif" height="16" width="16" /> checking username availability...');

this.timer = setTimeout(function () {
url: '../scripts/validatefunctions.php',
data: 'action=check_username&username=' + t.value,
dataType: 'json',
type: 'post',
success: function (j) {
}, 200);

this.lastValue = this.value;


<label for="username">Username, valid: a-z.-_</label>
<input type="text" name="username" value="" id="username" />
<span id="validateUsername"></span>


11-25-2009, 07:58 PM
You may be interested in the Validate plugin:


Dead simple to use.

12-08-2009, 11:51 AM
I have got many certificates and cleared many exams such as vmware certification (http://www.real-testking.com/vendor/VMware.htm) and as well as the pmp certification (http://www.real-testking.com/vendor/PMI.htm) at the last but not least the most important one the oracle certification (http://www.real-testking.com/vendor/Oracle.htm) but unable to understand the real concept of php and the exe files.Would you like to clear it for me?