Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:03:57+00:00 2026-06-18T01:03:57+00:00

I using a simple form where I’m validating a user login. Where I want

  • 0

I using a simple form where I’m validating a user login. Where I want to pass user name in my javascript POPUP for every successful login. For now it is only displaying Hello .I’m using concatination operator but no luck.

this is what my Javascript looks like

<script language="javascript">
        function show()
        {
            var n = document.getElementById("uname").value;
            alert("Hello "+n);
            return false;
        }
        function noshow()
        {
            alert("Invalid Login");
            return false;
        }
    </script>

HTML & Asp code

<form method="post" name="myform">
            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td>User Name:</td>
                    <td><input type="text" name="uname" value="" /></td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td><input type="password" name="pass" value="" /></td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="Login" name="sub" />
                        <input type="reset" value="Clear" />
                    </td>
                    <%
                        if Request.Form("sub") <> "" then
                            sql="select * from login_tbl where u_name = '" & Request.Form("uname") & "' AND pass= '" & Request.Form("pass") & "'"
                            rs.Open sql,con,1,2
                            if rs.Eof then 
                                Response.Write("<script language='javascript'>noshow();</script>")
                            else
                                'Response.Redirect("http://www.google.com")
                                Response.Write("<script language='javascript'>show();</script>")

                            end if
                            rs.Close
                        end if
                    %>
                </tr>
            </table>
        </form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:03:58+00:00Added an answer on June 18, 2026 at 1:03 am

    You just need to do something like this:

    <td><input type="text" id="uname" name="uname" value="<% Response.Write(Request.Form("uname")) %>" /></td>
    

    After you submit a form, uname became empty, and you need to restore value of uname element on server.

    Also, you are using document.getElementById(), but your uname element has no id. So it will find nothing. In order to avoid that, you need to add id to that input (like in my code above).

    But in this case uname will show username after form is submitted. If you do not need that, you can do something like this:

    <%
                            if Request.Form("sub") <> "" then
                                sql="select * from login_tbl where u_name = '" & Request.Form("uname") & "' AND pass= '" & Request.Form("pass") & "'"
                                rs.Open sql,con,1,2
                                if rs.Eof then 
                                    Response.Write("<script language='javascript'>noshow();</script>")
                                else
                                    'Response.Redirect("http://www.google.com")
                                    Response.Write("<script language='javascript'>show('" & Request.Form("uname") & "');</script>")
    
                                end if
                                rs.Close
                            end if
                        %>
    

    and update your function like this:

    function show(n)
            {
                alert("Hello "+n);
                return false;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a default value to a text-input field using simple-form. With
I'm using a simple form to insert posts to my MySQL database, I want
I want to create simple form using CForm (yii framework) but 'elements' => array('username'=>array('type'=>'text'))
I am using simple form gem and I am wondering how do you do
I have started using Simple-form and Bootstrap and I have tried to follow this
Im using the Simple form gem to setup a form on my rails app.
I'm using a simple web form and some PHP script to send the completed
I have installed VS2010 and MVC2 and testing a simple form using tinyMCE. When
Here is a simple form I am using to send XML data in admin_xml.php
Im using regular asp.net c# (webforms) i need to build a simple form that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.