submit form data with javascript 
September 4th, 2007, 06:34 AM
| | Newbie | | Join Date: Sep 2007
Posts: 2
| | submit form data with javascript - <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....
Last edited by gits; September 4th, 2007 at 06:48 AM.
Reason: added code tags
| 
September 4th, 2007, 06:45 AM
|  | Lives Here | | Join Date: Jan 2007 Location: India (West-Bengal) Age: 25
Posts: 2,429
| | 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.
| 
September 4th, 2007, 06:51 AM
|  | Moderator | | Join Date: May 2007 Location: Munich, Germany Age: 37
Posts: 3,780
| |
hi ...
changed thread-title to better describe the problem - always use a good thread title
kind regards
MOD
|  | | Thread Tools | Search this Thread | | | | | | | 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 220,662 network members.
|