/    Sign up×
Community /Pin to ProfileBookmark

javascript problem

Hi All I need to make a java script function in which i need to check if warehouse is selected the continue
else alert mesage should display.
I have written a java script code which i have called on submit event.
my code is running if i comment my if condition.
i m getting all the value which is required.
the problem i m getting from if to else condition.I m not getting even java script error but not getting the alert
and even not able to continue.
please help to solve my problem
below is my java script code
////
function chkWarehouse()
{
for (k=1;k<=document.form1.cnt.value;k++)
{
ware_id=”warehouse_id_”+k;
//alert (ware_id);
//alert(document.form1[ware_id].value==0);
if ((document.form1[ware_id].value==0) && (document.form1[ware_id].value==”Accepted”))
{
alert(“Please enter warehouse for the purchase order !”);
document.form1[ware_id].focus();
return false;
}
else
{
return true;
}
}
}

////

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisApr 11.2007 — if ((document.form1[ware_id].value==0) && (document.form1[ware_id].value=="Accepted"))[/quote]This will never be true. Maybe you want an "OR" function instead of an "AND" function.
×

Success!

Help @simi28 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...