Great day!
Kindly help me sir/madam..
Great day!
Kindly help me sir/madam..
Picture:http://i.imgur.com/yQAErOk.jpg
let say that: i have a 2 textbox as you see the image..
ORDER NUMBER 1. <input name="order_numbr"type="text" class="textbox" id="order_numbr" value="">
ORDER NAME 2. <input name="ur_name1" type="text" class="textbox" id="ur_name1" value="">
Ive already finished the 2 case but the 3rd case not yet done kindly help me please
case 1: If the order number is empty says "this field is required".
case 2: If you enter invalid order number says "This order number does not exists".
case 3: When If you enter valid order number automatically display order name in the textbox ORDER NAME without clicking a button..
Ive almost done but the order name doesnt display in the textbox ORDER NAME
Database:
order_no order_name
23532 House of Glass BC
32532 Inner Weather
53254 Fernwood Fitness
53253 Aspect Joinery
more.. more..
I want that the output of the order name is in default value. It is impossible to do this?
here is my code:
function.php
add_action('wp_ajax_nopriv_checkOrdrNum','checkOrdrNum');
add_action('wp_ajax_checkOrdrNum','checkOrdrNum');
function checkOrdrNum(){
global $wpdb,$current_user;
$orderno= $_POST['orderno'];
$ordr_num=$wpdb->get_row('SELECT * FROM art_work_history WHERE order_no = '.$orderno);
}
echo json_encode(array('order_no' => $ordr_num));
exit;
}
validationForm.js
jQuery.validator.addMethod("ordrNum",function(value,element){
var isExist=false;
$.ajax({
type : "POST",
async: false,
data : "action=checkOrdrNum&id=0&orderno=" + value,
url : ajaxurl,
dataType:"json",
success: function (data) {
alert(data){
isExist=true;
}
}
});
return isExist;//true;
},"This order number does not exist");
$(document).on('keyup', '#order_numbr', function() {
if( $('form').valid() ) {
$.post( ajaxurl, {"action":"checkOrdrNum","id":0,"orderno": $(this).val()},
function( data ) {
$('#order_name').val();
},
'json' );
}