asp and javascript message alert doesn't work











up vote
-1
down vote

favorite












here's my code



<%
if request.form("Add") = " Add " then

if request.form("txtdistributor") = "" or request.form("sinumber") = "" or request.form("tstdate") = "" or request.form("drnumber") = "" or request.form("drdate") = "" or request.form("receivedby") = "" then
response.redirect("salesinvoice.asp?userloggedin=" &request.querystring("userloggedin") &"&dist=" &request.QueryString("dist") )
end if


SQLString = "INSERT INTO salesinvoice (distributor,sidate,sinumber) VALUES ('" & Request.form("txtdistributor") & "','" & Request.Form("tstdate") & "','" & Request.Form("sinumber") &"') "

set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")

DBConn.Execute(SQLString)
DBConn.Close


set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")
SQLString = "INSERT INTO Delivery_Receipt (Date_Purchase, Receipt_no, Distributor, Received_by, Entry_Date,sinumber) VALUES"
SQLString = SQLString & "('" & Request.Form("drdate") & "','" & Request.Form("drnumber") & "', '" & Request.Form("txtdistributor")& "','" & Request.Form("receivedby") & "','" & now() & "','" & request.Form("sinumber") & "')"

DBConn.Execute(SQLString)
DBConn.Close



response.Redirect("salesinvoice.asp?userloggedin=" &request.QueryString("userloggedin") &"&dist=" &request.QueryString("dist"))

end if
%>


<!-- Javascript -->
<script type="text/javascript">

function validateform()
{
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.sinumber.value == '')
{
alert('Please input sales invoice number');
document.frm.sinumber.focus();
return false;
}
if (document.frm.tstdate.value == '')
{
alert('Please input sales invoice date');
document.frm.tstdate.focus();
return false;
}
if (document.frm.drnumber.value == '')
{
alert('Please input Delivery Receipt Number');
document.frm.drnumber.focus();
return false;
}
if (document.frm.drdate.value == '')
{
alert('Please input Delivery Receipt');
document.frm.drdate.focus();
return false;
}
if (document.frm.receivedby.value == '')
{
alert('Please input requestor');
document.frm.receivedby.focus();
return false;
}
return true;
}
</script>
<html>
<head>
<title>Sales Invoice</title>
</head>
<body>

<!--#include file="header.asp"-->
<form name="frm" id="frm" action="salesinvoice.asp?userloggedin=<%=request.QueryString("userloggedin")%>&dist=<%=request.QueryString("dist")%>" method="post" onSubmit="return validateform();">

<link href="css/calendar.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="calendar_date_picker.js"></script>
<script type="text/javascript">
var cdp1 = new CalendarDatePicker();
var props = {
debug : true,
excludeDays : [6,0,1],
excludeDates : ['20081225','20081226','20091225','20091226'],
minimumFutureDate : 5,
formatDate : '%m-%d-%y'
};
var cdp2 = new CalendarDatePicker(props);
props.formatDate = '%d-%m-%y';
var cdp3 = new CalendarDatePicker(props);
cdp3.endYear = cdp3.startYear + 1;
</script>

<table width="900" align="center">
<tr>
<td width="200">Distributor</td>
<td>

<%if request.querystring("dist") <> "yes" then%>

<select name="txtdistributor" style="width:260;">
<option value="">- Select -</option>
<%
strsql = "select Distinct(Distributor) from salesinvoice"
set rsdist = server.createobject("adodb.recordset")
rsdist.open strsql,application("dals_connectionstring")

while not rsdist.eof
%>

<option value="<%=rsdist("distributor")%>"><%=rsdist("distributor")%></option>

<%
rsdist.movenext
wend

rsdist.close
set rsdist = nothing
%>
</select>&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=yes">Add New Distributor</a>
<%end if%>

<%if request.querystring("dist") <> "no" then%>
<input type="text" size="38" name="txtdistributor" id="txtdistributor">&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=no">[ - ]</a>
<%end if%>

</td>
</tr>
<tr>
<td>SI Number</td>
<td><input type="text" name="sinumber" id="sinumber"></td>
</tr>
<tr>
<td>SI Date</td>
<td><input type="text" name="tstdate" id="txtdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'txtdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>DR Number</td>
<td><input type="text" name="drnumber" id="drnumber"></td>
</tr>
<tr>
<td>DR date</td>
<td><input type="text" name="drdate" id="drdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'drdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>Received by</td>
<td>
<!--<input type="text" name="receivedby" id="receivedby">-->
<select name="receivedby" id="receivedby">
<option value="">- Select -</option>
<%
strsql = "select first_name,last_name from sysadusers"
set rsname = server.CreateObject("adodb.recordset")
rsname.open strsql,application("dals_connectionstring")

while not rsname.eof
%>
<option value="<%=rsname("first_name")%>, <%=rsname("last_name")%>"><%=rsname("first_name")%>, <%=rsname("last_name")%></option>
<%
rsname.movenext
wend

rsname.close
%>

</select>









share|improve this question
























  • SQL injection attack, anyone?
    – Phil.Wheeler
    Jun 9 '11 at 1:58










  • how sir can you teach me thanks
    – user772304
    Jun 9 '11 at 2:47










  • @Phil.Wheeler that is separate issue in this case, the issue here is on scripting
    – AjayR
    Jun 9 '11 at 3:15

















up vote
-1
down vote

favorite












here's my code



<%
if request.form("Add") = " Add " then

if request.form("txtdistributor") = "" or request.form("sinumber") = "" or request.form("tstdate") = "" or request.form("drnumber") = "" or request.form("drdate") = "" or request.form("receivedby") = "" then
response.redirect("salesinvoice.asp?userloggedin=" &request.querystring("userloggedin") &"&dist=" &request.QueryString("dist") )
end if


SQLString = "INSERT INTO salesinvoice (distributor,sidate,sinumber) VALUES ('" & Request.form("txtdistributor") & "','" & Request.Form("tstdate") & "','" & Request.Form("sinumber") &"') "

set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")

DBConn.Execute(SQLString)
DBConn.Close


set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")
SQLString = "INSERT INTO Delivery_Receipt (Date_Purchase, Receipt_no, Distributor, Received_by, Entry_Date,sinumber) VALUES"
SQLString = SQLString & "('" & Request.Form("drdate") & "','" & Request.Form("drnumber") & "', '" & Request.Form("txtdistributor")& "','" & Request.Form("receivedby") & "','" & now() & "','" & request.Form("sinumber") & "')"

DBConn.Execute(SQLString)
DBConn.Close



response.Redirect("salesinvoice.asp?userloggedin=" &request.QueryString("userloggedin") &"&dist=" &request.QueryString("dist"))

end if
%>


<!-- Javascript -->
<script type="text/javascript">

function validateform()
{
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.sinumber.value == '')
{
alert('Please input sales invoice number');
document.frm.sinumber.focus();
return false;
}
if (document.frm.tstdate.value == '')
{
alert('Please input sales invoice date');
document.frm.tstdate.focus();
return false;
}
if (document.frm.drnumber.value == '')
{
alert('Please input Delivery Receipt Number');
document.frm.drnumber.focus();
return false;
}
if (document.frm.drdate.value == '')
{
alert('Please input Delivery Receipt');
document.frm.drdate.focus();
return false;
}
if (document.frm.receivedby.value == '')
{
alert('Please input requestor');
document.frm.receivedby.focus();
return false;
}
return true;
}
</script>
<html>
<head>
<title>Sales Invoice</title>
</head>
<body>

<!--#include file="header.asp"-->
<form name="frm" id="frm" action="salesinvoice.asp?userloggedin=<%=request.QueryString("userloggedin")%>&dist=<%=request.QueryString("dist")%>" method="post" onSubmit="return validateform();">

<link href="css/calendar.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="calendar_date_picker.js"></script>
<script type="text/javascript">
var cdp1 = new CalendarDatePicker();
var props = {
debug : true,
excludeDays : [6,0,1],
excludeDates : ['20081225','20081226','20091225','20091226'],
minimumFutureDate : 5,
formatDate : '%m-%d-%y'
};
var cdp2 = new CalendarDatePicker(props);
props.formatDate = '%d-%m-%y';
var cdp3 = new CalendarDatePicker(props);
cdp3.endYear = cdp3.startYear + 1;
</script>

<table width="900" align="center">
<tr>
<td width="200">Distributor</td>
<td>

<%if request.querystring("dist") <> "yes" then%>

<select name="txtdistributor" style="width:260;">
<option value="">- Select -</option>
<%
strsql = "select Distinct(Distributor) from salesinvoice"
set rsdist = server.createobject("adodb.recordset")
rsdist.open strsql,application("dals_connectionstring")

while not rsdist.eof
%>

<option value="<%=rsdist("distributor")%>"><%=rsdist("distributor")%></option>

<%
rsdist.movenext
wend

rsdist.close
set rsdist = nothing
%>
</select>&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=yes">Add New Distributor</a>
<%end if%>

<%if request.querystring("dist") <> "no" then%>
<input type="text" size="38" name="txtdistributor" id="txtdistributor">&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=no">[ - ]</a>
<%end if%>

</td>
</tr>
<tr>
<td>SI Number</td>
<td><input type="text" name="sinumber" id="sinumber"></td>
</tr>
<tr>
<td>SI Date</td>
<td><input type="text" name="tstdate" id="txtdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'txtdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>DR Number</td>
<td><input type="text" name="drnumber" id="drnumber"></td>
</tr>
<tr>
<td>DR date</td>
<td><input type="text" name="drdate" id="drdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'drdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>Received by</td>
<td>
<!--<input type="text" name="receivedby" id="receivedby">-->
<select name="receivedby" id="receivedby">
<option value="">- Select -</option>
<%
strsql = "select first_name,last_name from sysadusers"
set rsname = server.CreateObject("adodb.recordset")
rsname.open strsql,application("dals_connectionstring")

while not rsname.eof
%>
<option value="<%=rsname("first_name")%>, <%=rsname("last_name")%>"><%=rsname("first_name")%>, <%=rsname("last_name")%></option>
<%
rsname.movenext
wend

rsname.close
%>

</select>









share|improve this question
























  • SQL injection attack, anyone?
    – Phil.Wheeler
    Jun 9 '11 at 1:58










  • how sir can you teach me thanks
    – user772304
    Jun 9 '11 at 2:47










  • @Phil.Wheeler that is separate issue in this case, the issue here is on scripting
    – AjayR
    Jun 9 '11 at 3:15















up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











here's my code



<%
if request.form("Add") = " Add " then

if request.form("txtdistributor") = "" or request.form("sinumber") = "" or request.form("tstdate") = "" or request.form("drnumber") = "" or request.form("drdate") = "" or request.form("receivedby") = "" then
response.redirect("salesinvoice.asp?userloggedin=" &request.querystring("userloggedin") &"&dist=" &request.QueryString("dist") )
end if


SQLString = "INSERT INTO salesinvoice (distributor,sidate,sinumber) VALUES ('" & Request.form("txtdistributor") & "','" & Request.Form("tstdate") & "','" & Request.Form("sinumber") &"') "

set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")

DBConn.Execute(SQLString)
DBConn.Close


set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")
SQLString = "INSERT INTO Delivery_Receipt (Date_Purchase, Receipt_no, Distributor, Received_by, Entry_Date,sinumber) VALUES"
SQLString = SQLString & "('" & Request.Form("drdate") & "','" & Request.Form("drnumber") & "', '" & Request.Form("txtdistributor")& "','" & Request.Form("receivedby") & "','" & now() & "','" & request.Form("sinumber") & "')"

DBConn.Execute(SQLString)
DBConn.Close



response.Redirect("salesinvoice.asp?userloggedin=" &request.QueryString("userloggedin") &"&dist=" &request.QueryString("dist"))

end if
%>


<!-- Javascript -->
<script type="text/javascript">

function validateform()
{
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.sinumber.value == '')
{
alert('Please input sales invoice number');
document.frm.sinumber.focus();
return false;
}
if (document.frm.tstdate.value == '')
{
alert('Please input sales invoice date');
document.frm.tstdate.focus();
return false;
}
if (document.frm.drnumber.value == '')
{
alert('Please input Delivery Receipt Number');
document.frm.drnumber.focus();
return false;
}
if (document.frm.drdate.value == '')
{
alert('Please input Delivery Receipt');
document.frm.drdate.focus();
return false;
}
if (document.frm.receivedby.value == '')
{
alert('Please input requestor');
document.frm.receivedby.focus();
return false;
}
return true;
}
</script>
<html>
<head>
<title>Sales Invoice</title>
</head>
<body>

<!--#include file="header.asp"-->
<form name="frm" id="frm" action="salesinvoice.asp?userloggedin=<%=request.QueryString("userloggedin")%>&dist=<%=request.QueryString("dist")%>" method="post" onSubmit="return validateform();">

<link href="css/calendar.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="calendar_date_picker.js"></script>
<script type="text/javascript">
var cdp1 = new CalendarDatePicker();
var props = {
debug : true,
excludeDays : [6,0,1],
excludeDates : ['20081225','20081226','20091225','20091226'],
minimumFutureDate : 5,
formatDate : '%m-%d-%y'
};
var cdp2 = new CalendarDatePicker(props);
props.formatDate = '%d-%m-%y';
var cdp3 = new CalendarDatePicker(props);
cdp3.endYear = cdp3.startYear + 1;
</script>

<table width="900" align="center">
<tr>
<td width="200">Distributor</td>
<td>

<%if request.querystring("dist") <> "yes" then%>

<select name="txtdistributor" style="width:260;">
<option value="">- Select -</option>
<%
strsql = "select Distinct(Distributor) from salesinvoice"
set rsdist = server.createobject("adodb.recordset")
rsdist.open strsql,application("dals_connectionstring")

while not rsdist.eof
%>

<option value="<%=rsdist("distributor")%>"><%=rsdist("distributor")%></option>

<%
rsdist.movenext
wend

rsdist.close
set rsdist = nothing
%>
</select>&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=yes">Add New Distributor</a>
<%end if%>

<%if request.querystring("dist") <> "no" then%>
<input type="text" size="38" name="txtdistributor" id="txtdistributor">&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=no">[ - ]</a>
<%end if%>

</td>
</tr>
<tr>
<td>SI Number</td>
<td><input type="text" name="sinumber" id="sinumber"></td>
</tr>
<tr>
<td>SI Date</td>
<td><input type="text" name="tstdate" id="txtdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'txtdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>DR Number</td>
<td><input type="text" name="drnumber" id="drnumber"></td>
</tr>
<tr>
<td>DR date</td>
<td><input type="text" name="drdate" id="drdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'drdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>Received by</td>
<td>
<!--<input type="text" name="receivedby" id="receivedby">-->
<select name="receivedby" id="receivedby">
<option value="">- Select -</option>
<%
strsql = "select first_name,last_name from sysadusers"
set rsname = server.CreateObject("adodb.recordset")
rsname.open strsql,application("dals_connectionstring")

while not rsname.eof
%>
<option value="<%=rsname("first_name")%>, <%=rsname("last_name")%>"><%=rsname("first_name")%>, <%=rsname("last_name")%></option>
<%
rsname.movenext
wend

rsname.close
%>

</select>









share|improve this question















here's my code



<%
if request.form("Add") = " Add " then

if request.form("txtdistributor") = "" or request.form("sinumber") = "" or request.form("tstdate") = "" or request.form("drnumber") = "" or request.form("drdate") = "" or request.form("receivedby") = "" then
response.redirect("salesinvoice.asp?userloggedin=" &request.querystring("userloggedin") &"&dist=" &request.QueryString("dist") )
end if


SQLString = "INSERT INTO salesinvoice (distributor,sidate,sinumber) VALUES ('" & Request.form("txtdistributor") & "','" & Request.Form("tstdate") & "','" & Request.Form("sinumber") &"') "

set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")

DBConn.Execute(SQLString)
DBConn.Close


set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open Application("dals_ConnectionString")
SQLString = "INSERT INTO Delivery_Receipt (Date_Purchase, Receipt_no, Distributor, Received_by, Entry_Date,sinumber) VALUES"
SQLString = SQLString & "('" & Request.Form("drdate") & "','" & Request.Form("drnumber") & "', '" & Request.Form("txtdistributor")& "','" & Request.Form("receivedby") & "','" & now() & "','" & request.Form("sinumber") & "')"

DBConn.Execute(SQLString)
DBConn.Close



response.Redirect("salesinvoice.asp?userloggedin=" &request.QueryString("userloggedin") &"&dist=" &request.QueryString("dist"))

end if
%>


<!-- Javascript -->
<script type="text/javascript">

function validateform()
{
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.txtdistributor.value == '')
{
alert('Please input distributor');
document.frm.txtdistributor.focus();
return false;
}
if (document.frm.sinumber.value == '')
{
alert('Please input sales invoice number');
document.frm.sinumber.focus();
return false;
}
if (document.frm.tstdate.value == '')
{
alert('Please input sales invoice date');
document.frm.tstdate.focus();
return false;
}
if (document.frm.drnumber.value == '')
{
alert('Please input Delivery Receipt Number');
document.frm.drnumber.focus();
return false;
}
if (document.frm.drdate.value == '')
{
alert('Please input Delivery Receipt');
document.frm.drdate.focus();
return false;
}
if (document.frm.receivedby.value == '')
{
alert('Please input requestor');
document.frm.receivedby.focus();
return false;
}
return true;
}
</script>
<html>
<head>
<title>Sales Invoice</title>
</head>
<body>

<!--#include file="header.asp"-->
<form name="frm" id="frm" action="salesinvoice.asp?userloggedin=<%=request.QueryString("userloggedin")%>&dist=<%=request.QueryString("dist")%>" method="post" onSubmit="return validateform();">

<link href="css/calendar.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="calendar_date_picker.js"></script>
<script type="text/javascript">
var cdp1 = new CalendarDatePicker();
var props = {
debug : true,
excludeDays : [6,0,1],
excludeDates : ['20081225','20081226','20091225','20091226'],
minimumFutureDate : 5,
formatDate : '%m-%d-%y'
};
var cdp2 = new CalendarDatePicker(props);
props.formatDate = '%d-%m-%y';
var cdp3 = new CalendarDatePicker(props);
cdp3.endYear = cdp3.startYear + 1;
</script>

<table width="900" align="center">
<tr>
<td width="200">Distributor</td>
<td>

<%if request.querystring("dist") <> "yes" then%>

<select name="txtdistributor" style="width:260;">
<option value="">- Select -</option>
<%
strsql = "select Distinct(Distributor) from salesinvoice"
set rsdist = server.createobject("adodb.recordset")
rsdist.open strsql,application("dals_connectionstring")

while not rsdist.eof
%>

<option value="<%=rsdist("distributor")%>"><%=rsdist("distributor")%></option>

<%
rsdist.movenext
wend

rsdist.close
set rsdist = nothing
%>
</select>&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=yes">Add New Distributor</a>
<%end if%>

<%if request.querystring("dist") <> "no" then%>
<input type="text" size="38" name="txtdistributor" id="txtdistributor">&nbsp;<a href="salesinvoice.asp?UserLoggedIn=<%=request.QueryString("UserLoggedIn")%>&dist=no">[ - ]</a>
<%end if%>

</td>
</tr>
<tr>
<td>SI Number</td>
<td><input type="text" name="sinumber" id="sinumber"></td>
</tr>
<tr>
<td>SI Date</td>
<td><input type="text" name="tstdate" id="txtdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'txtdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>DR Number</td>
<td><input type="text" name="drnumber" id="drnumber"></td>
</tr>
<tr>
<td>DR date</td>
<td><input type="text" name="drdate" id="drdate" readonly>&nbsp;<a href="#" onClick="cdp1.showCalendar(this, 'drdate'); return false;"><img src="images/calendar.png" border="0" align="absmiddle" style="cursor:hand;" title="Calendar"></a></td>
</tr>
<tr>
<td>Received by</td>
<td>
<!--<input type="text" name="receivedby" id="receivedby">-->
<select name="receivedby" id="receivedby">
<option value="">- Select -</option>
<%
strsql = "select first_name,last_name from sysadusers"
set rsname = server.CreateObject("adodb.recordset")
rsname.open strsql,application("dals_connectionstring")

while not rsname.eof
%>
<option value="<%=rsname("first_name")%>, <%=rsname("last_name")%>"><%=rsname("first_name")%>, <%=rsname("last_name")%></option>
<%
rsname.movenext
wend

rsname.close
%>

</select>






javascript html vbscript asp-classic






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 11:06









Cœur

16.9k9102139




16.9k9102139










asked Jun 9 '11 at 1:43









user772304

11




11












  • SQL injection attack, anyone?
    – Phil.Wheeler
    Jun 9 '11 at 1:58










  • how sir can you teach me thanks
    – user772304
    Jun 9 '11 at 2:47










  • @Phil.Wheeler that is separate issue in this case, the issue here is on scripting
    – AjayR
    Jun 9 '11 at 3:15




















  • SQL injection attack, anyone?
    – Phil.Wheeler
    Jun 9 '11 at 1:58










  • how sir can you teach me thanks
    – user772304
    Jun 9 '11 at 2:47










  • @Phil.Wheeler that is separate issue in this case, the issue here is on scripting
    – AjayR
    Jun 9 '11 at 3:15


















SQL injection attack, anyone?
– Phil.Wheeler
Jun 9 '11 at 1:58




SQL injection attack, anyone?
– Phil.Wheeler
Jun 9 '11 at 1:58












how sir can you teach me thanks
– user772304
Jun 9 '11 at 2:47




how sir can you teach me thanks
– user772304
Jun 9 '11 at 2:47












@Phil.Wheeler that is separate issue in this case, the issue here is on scripting
– AjayR
Jun 9 '11 at 3:15






@Phil.Wheeler that is separate issue in this case, the issue here is on scripting
– AjayR
Jun 9 '11 at 3:15














1 Answer
1






active

oldest

votes

















up vote
0
down vote













You might have runtime error in the validation function, for example when the form does not contain the txtdistributor drop down.



For the sake of debugging, change the function to this only:



function validateform() {
alert("validation started");
var oDDL = document.frm.txtdistributor;
if (oDDL) {
if (oDDL.value == '') {
alert('Please input distributor');
oDDL.focus();
}
} else {
alert("form does not contain txtdistributor");
}
alert("validation ended");

return false;
}


If this works, apply the same logic for the rest of the fields and remove the debug messages.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f6287201%2fasp-and-javascript-message-alert-doesnt-work%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You might have runtime error in the validation function, for example when the form does not contain the txtdistributor drop down.



    For the sake of debugging, change the function to this only:



    function validateform() {
    alert("validation started");
    var oDDL = document.frm.txtdistributor;
    if (oDDL) {
    if (oDDL.value == '') {
    alert('Please input distributor');
    oDDL.focus();
    }
    } else {
    alert("form does not contain txtdistributor");
    }
    alert("validation ended");

    return false;
    }


    If this works, apply the same logic for the rest of the fields and remove the debug messages.






    share|improve this answer

























      up vote
      0
      down vote













      You might have runtime error in the validation function, for example when the form does not contain the txtdistributor drop down.



      For the sake of debugging, change the function to this only:



      function validateform() {
      alert("validation started");
      var oDDL = document.frm.txtdistributor;
      if (oDDL) {
      if (oDDL.value == '') {
      alert('Please input distributor');
      oDDL.focus();
      }
      } else {
      alert("form does not contain txtdistributor");
      }
      alert("validation ended");

      return false;
      }


      If this works, apply the same logic for the rest of the fields and remove the debug messages.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        You might have runtime error in the validation function, for example when the form does not contain the txtdistributor drop down.



        For the sake of debugging, change the function to this only:



        function validateform() {
        alert("validation started");
        var oDDL = document.frm.txtdistributor;
        if (oDDL) {
        if (oDDL.value == '') {
        alert('Please input distributor');
        oDDL.focus();
        }
        } else {
        alert("form does not contain txtdistributor");
        }
        alert("validation ended");

        return false;
        }


        If this works, apply the same logic for the rest of the fields and remove the debug messages.






        share|improve this answer












        You might have runtime error in the validation function, for example when the form does not contain the txtdistributor drop down.



        For the sake of debugging, change the function to this only:



        function validateform() {
        alert("validation started");
        var oDDL = document.frm.txtdistributor;
        if (oDDL) {
        if (oDDL.value == '') {
        alert('Please input distributor');
        oDDL.focus();
        }
        } else {
        alert("form does not contain txtdistributor");
        }
        alert("validation ended");

        return false;
        }


        If this works, apply the same logic for the rest of the fields and remove the debug messages.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 9 '11 at 9:19









        Shadow Wizard

        56.7k18107172




        56.7k18107172






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f6287201%2fasp-and-javascript-message-alert-doesnt-work%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Schultheiß

            Liste der Kulturdenkmale in Wilsdruff

            Android Play Services Check