By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,558 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

submit form data with javascript

P: 2
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function log_Varify()
  3. {
  4. if(document.frm_index.txt_id.value=="")
  5. {
  6.     alert("Enter your Login Id")
  7.     frm_index.txt_id.focus()
  8.     }
  9. else if(document.frm_index.txt_pwd.value=="")
  10. {
  11.     alert("Enter your Password")
  12.     frm_index.txt_pwd.focus()
  13. }
  14. else
  15. {
  16.     frm_index.method="post" 
  17.     frm_index.action="Login_amit.asp?mode=login"
  18.     frm_index.submit()
  19. }
  20.  
  21. }
  22. </script>
  23.  
  24. <%             
  25. if(request.queryString("mode")="login") then
  26.     logId=Request.Form("txt_id")
  27.     pass=Request.Form("txt_pwd")
  28.     Dim conn, rs
  29.     strconn = "DRIVER={SQL Server};SERVER=127.0.0.1; DATABASE=sql17529_db_shoppersmanual;UID=ad17529; PWD=shoppers"
  30.     set rs=Server.CreateObject("ADODB.Recordset")
  31.     str="prc_userlogin '"&logId&"','"&pass&"' "
  32.     'select * from userlogin where userId = '"'&logId&'" and password= '"'&pass&'" 
  33.     rs.Open str,strconn    
  34.     if(not rs.EOF) then
  35.         Response.Cookies("Usrlgn")=logId
  36.         Response.Cookies("Pass")=pass
  37.                 response.redirect("index.asp")
  38.     else 
  39.             rs.Close
  40.         Response.write "<strong><font color='#FF0000' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Invalid User </font>"
  41.     end if  
  42. end if
  43. %>
  44.  
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....
Sep 4 '07 #1
Share this Question
Share on Google+
2 Replies


dmjpro
100+
P: 2,476
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function log_Varify()
  3. {
  4. if(document.frm_index.txt_id.value=="")
  5. {
  6.     alert("Enter your Login Id")
  7.     frm_index.txt_id.focus()
  8.     }
  9. else if(document.frm_index.txt_pwd.value=="")
  10. {
  11.     alert("Enter your Password")
  12.     frm_index.txt_pwd.focus()
  13. }
  14. else
  15. {
  16.     frm_index.method="post" 
  17.     frm_index.action="Login_amit.asp?mode=login"
  18.     frm_index.submit()
  19. }
  20.  
  21. }
  22. </script>
  23.  
Expand|Select|Wrap|Line Numbers
  1. <%             
  2. if(request.queryString("mode")="login") then
  3.     logId=Request.Form("txt_id")
  4.     pass=Request.Form("txt_pwd")
  5.     Dim conn, rs
  6.     strconn = "DRIVER={SQL Server};SERVER=127.0.0.1; DATABASE=sql17529_db_shoppersmanual;UID=ad17529; PWD=shoppers"
  7.     set rs=Server.CreateObject("ADODB.Recordset")
  8.     str="prc_userlogin '"&logId&"','"&pass&"' "
  9.     'select * from userlogin where userId = '"'&logId&'" and password= '"'&pass&'" 
  10.     rs.Open str,strconn    
  11.     if(not rs.EOF) then
  12.         Response.Cookies("Usrlgn")=logId
  13.         Response.Cookies("Pass")=pass
  14.                 response.redirect("index.asp")
  15.     else 
  16.             rs.Close
  17.         Response.write "<strong><font color='#FF0000' size='2' face='Verdana, Arial, Helvetica, sans-serif'>Invalid User </font>"
  18.     end if  
  19. end if
  20. %>
  21.  
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.
Expand|Select|Wrap|Line Numbers
  1. document.frm_index.method="post" 
  2. document.frm_index.action="Login_amit.asp?mode=login"
  3. document.frm_index.submit()
  4.  
And Best of Luck with your Code.

Kind regards,
Dmjpro.
Sep 4 '07 #2

gits
Expert Mod 5K+
P: 5,353
hi ...

changed thread-title to better describe the problem - always use a good thread title

kind regards
MOD
Sep 4 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.