Check Data type using JavaScript

Introduction

This Post is Explain About to Check Data type using JavaScrip.

 

Use the below script to perform duplicate data validation along with numeric data type validation in Javascript.

<!–duplicate checking for lpn –>

<script>

function check_lpn(pThis)

{

var j_item_id=pThis.id;

var k_item_id=’#f02’+j_item_id.substr(3);

//alert(j_item_id);

//alert(k_item_id);

var h=’#’+j_item_id;

//alert(h);

var a= $(h).val();

var g=$(k_item_id).val();

//alert(a);

//alert(g);

if(isNaN(a)){

alert(‘The LPN is not numeric.Kindly enter numeric values’);

$(h).focus();

}

else{

if (g)

{

var get = new htmldb_Get(null, $v(‘pFlowId’),’APPLICATION_PROCESS=Duplicate_LPN_check’,$v(‘pFlowStepId’));

get.add(‘AI_LPN’,a);

//get.add(‘AI_SHIPPING_ID’,g);

ret = get.get();

//alert(ret);

if (ret != 0)

{

var get = new htmldb_Get(null, $v(‘pFlowId’),’APPLICATION_PROCESS=Duplicate_LPN_Shipping_id’,$v(‘pFlowStepId’));

get.add(‘AI_LPN’,a);

ret = get.get();

if(ret != g)

{

alert(‘The LPN is already present.Kindly select another LPN’);

$(h).val(null);

$(h).focus();

}

}

}

else

{

var i = 1;

var j=0;

var b,a,c,f;

while (i != 0) {

b = “000” + i;

b = pad(i, 4);

d = $(‘#f05_’+b).val();

//alert(d);

//alert(typeof d);

if (typeof d === “undefined”) {

i=0;

}

else

{

if(a == d)

{j= j+1;

}

if(j>1)

{

alert(‘The LPN is already present.Kindly select another LPN’);

$(h).val(null);

$(h).focus();

break;

}

i= i+1;

}

}

}

}

}

</script>

Got any queries?

Do drop a note by writing us at Doyen.ebiz@staging.doyensys.com or use the comment section below to ask your questions.

Recent Posts