submit form data with javascript
Question posted by: amithoptima3851
(Newbie)
on
September 4th, 2007 07:34 AM
- <script language="javascript">
-
function log_Varify()
-
{
-
if(document.frm_index.txt_id.value=="")
-
{
-
alert("Enter your Login Id")
-
frm_index.txt_id.focus()
-
}
-
else if(document.frm_index.txt_pwd.value=="")
-
{
-
alert("Enter your Password")
-
frm_index.txt_pwd.focus()
-
}
-
else
-
{
-
frm_index.method="post"
-
frm_index.action="Login_amit.asp?mode=login"
-
frm_index.submit()
-
}
-
-
}
-
</script>
-
-
<%
-
if(request.queryString("mode")="login") then
-
logId=Request.Form("txt_id")
-
pass=Request.Form("txt_pwd")
-
Dim conn, rs
-
strconn = "DRIVER={SQL Server};SERVER=127.0.0.1; DATABASE=sql17529_db_shoppersmanual;UID=ad17529; PWD=shoppers"
-
set rs=Server.CreateObject("ADODB.Recordset")
-
str="prc_userlogin '"&logId&"','"&pass&"' "
-
'select * from userlogin where userId = '"'&logId&'" and password= '"'&pass&'"
-
rs.Open str,strconn
-
if(not rs.EOF) then
-
Response.Cookies("Usrlgn")=logId
-
Response.Cookies("Pass")=pass
-
response.redirect("index.asp")
-
else
-
rs.Close
-
Response.write "<strong><font color='#FF0000' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Invalid User </font>"
-
end if
-
end if
-
%>
Hello All,
This was my javascript+ASP code for login ,onclick of a button(i am calling javascript function)its validating but its not submitting.As far as i know database connections are perfect i used it in another form.
Please help me....
2
Answers Posted
Quote:
Originally Posted by amithoptima3851
-
<script language="javascript">
-
function log_Varify()
-
{
-
if(document.frm_index.txt_id.value=="")
-
{
-
alert("Enter your Login Id")
-
frm_index.txt_id.focus()
-
}
-
else if(document.frm_index.txt_pwd.value=="")
-
{
-
alert("Enter your Password")
-
frm_index.txt_pwd.focus()
-
}
-
else
-
{
-
frm_index.method="post"
-
frm_index.action="Login_amit.asp?mode=login"
-
frm_index.submit()
-
}
-
-
}
-
</script>
-
<%
-
if(request.queryString("mode")="login") then
-
logId=Request.Form("txt_id")
-
pass=Request.Form("txt_pwd")
-
Dim conn, rs
-
strconn = "DRIVER={SQL Server};SERVER=127.0.0.1; DATABASE=sql17529_db_shoppersmanual;UID=ad17529; PWD=shoppers"
-
set rs=Server.CreateObject("ADODB.Recordset")
-
str="prc_userlogin '"&logId&"','"&pass&"' "
-
'select * from userlogin where userId = '"'&logId&'" and password= '"'&pass&'"
-
rs.Open str,strconn
-
if(not rs.EOF) then
-
Response.Cookies("Usrlgn")=logId
-
Response.Cookies("Pass")=pass
-
response.redirect("index.asp")
-
else
-
rs.Close
-
Response.write "<strong><font color='#FF0000' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Invalid User </font>"
-
end if
-
end if
-
%>
Hello All,
This was my javascript+ASP code for login ,onclick of a button(i am calling javascript function)its validating but its not submitting.As far as i know database connections are perfect i used it in another form.
Please help me....
Hi amithoptima3851!
You should maintain the Post Guidelines.
Use code Tag.
Use this.
-
document.frm_index.method="post"
-
document.frm_index.action="Login_amit.asp?mode=login"
-
document.frm_index.submit()
And Best of Luck with your Code.
Kind regards,
Dmjpro.
hi ...
changed thread-title to better describe the problem - always use a good thread title
kind regards
MOD
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 196,941 network members.
Top Javascript / DHTML / Ajax Contributors
|