New in Javascript. Please Help....
I have two text fields. One for 9450 device and another for QR device. Now if the user enters a Transmitter id which is already assigned into the text field for 9450 device and hits SAVE button, no error message displays in the screen. Same for the QR text field.
Now we have to modify the code so that we can display an alert message when the user enters a TXID which is already assigned and in the range into the text field for 9450 device and hits the SAVE button.
I tried to modified the code in following way (please see the BOLD PART)
I have added the methods isAssigned9450Tag() for 9450 device and isAssignedQRTag() for QR device. Both of these methods returns true when the TXID is already assigned, false otherwise.
for ( int i = 0; i < testTxs.length; ++i )
{
if ( true == DeviceIDRange.t9450.equals( testTxs[i].type ) )
{
testTx9450Value = testTxs[i].txId;
[b:1gbcb8o5]boolean isdup9450tag = dup9450tag.isAssigned9450Tag( testTx9450Value );
System.out.println("The value of isdup9450tag is: " + isdup9450tag + "\n\n");[/b:1gbcb8o5] }
else
if ( true == DeviceIDRange.tinov.equals( testTxs[i].type ) )
{
testTxInovValue = testTxs[i].txId;
[b:1gbcb8o5]boolean isdupQRtag = dup9450tag.isAssignedQRTag( testTxInovValue );
System.out.println("The value of isdupQRtag is: " + isdupQRtag + "\n\n");[/b:1gbcb8o5] }
}
I have tried to implement them into the javascript function for Save button like the following:
function testTxCheck( element )
{
if ( 0 != element.value.length )
{
if ( true == isNumeric( element.value ) )
{
if ( false == testTxCheckNumberType( element.value, element.name.substring(6) ) )
{
alert( element.value + " must be within a specified TX ID Range" );
element.value = "";
element.focus();
return false;
}
[b:1gbcb8o5]else
{
if ( true == isdup9450tag )
{
alert("The TXID is already assigned");
return false;
}
else if ( true == isdupQRtag )
{
alert("The TXID is already assigned");
return false;
}
}[/b:1gbcb8o5] }
else
{
alert( element.value + " is not a numeric value" );
element.value = "";
element.focus();
return false;
}
}
return true;
}
But I am not successful. I am wondering if someone can help me out to display the alert message when the user enters a TXID which is already assigned into the text fields both for 9450 or QR devices and hits the save button. I would appreciate your kind help. Thanks..