LyndonOHRC
Programmer
The first code block works fine, however, I have three conditions for my if statement. I am new at this and understand that the && logical operator is the same as the OR logical operator in other languages.
The second code section is how I'm trying to use multiple conditions in this if statement but it always evaluates to false even when I know the data should return a true.
Any help is appreciated.
Lyndon
This works:
This does not, it always evaluates to false:
The second code section is how I'm trying to use multiple conditions in this if statement but it always evaluates to false even when I know the data should return a true.
Any help is appreciated.
Lyndon
This works:
Code:
function FillAmount()
{
if (document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].value=='Blacksmith')
{
if (document.ReceiptForm.Amount.value!=='120')
{
document.forms["ReceiptForm"].elements["Amount"].value = document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].title;
}
}
else
{
document.forms["ReceiptForm"].elements["Amount"].value = document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].title;
}
}
This does not, it always evaluates to false:
Code:
function FillAmount()
{
if (document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].value=='Blacksmith' [COLOR=red]&& [/color red]document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].value=='Veterinarian')
{
if (document.ReceiptForm.Amount.value!=='120')
{
document.forms["ReceiptForm"].elements["Amount"].value = document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].title;
}
}
else
{
document.forms["ReceiptForm"].elements["Amount"].value = document.forms["ReceiptForm"].elements["LicenseTypeOther"].options[document.forms["ReceiptForm"].elements["LicenseTypeOther"].selectedIndex].title;
}
}