?
Solved

forms login and password help

Posted on 2004-11-13
5
Medium Priority
?
236 Views
Last Modified: 2010-05-02
I want to submit a username and password from one form and submit it to annother using the webbrowser control to login to a website like this:

"form2"
enter username and password
*user submits Username and Password*
*form2 hides and form1 shows*

"form1"
*webbrowser1 shows website then logs into account*
0
Comment
Question by:chrisyroid
  • 4
5 Comments
 
LVL 54

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 12577423
In form1 , try insert:

Private Sub Command1_Click()
    Form2.Show vbModal
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set Form1 = Nothing
End Sub

in form 2:

Private Sub Command1_Click()
    Form1.WebBrowser1.Navigate2 "http://www.yourdomain.dom/app/login.html"
   
    Unload Me
    DoEvents
   
    Do While Form1.WebBrowser1.Busy
        DoEvents
    Loop    
   
    With Form1.WebBrowser1.Document
        .All("loginID").Value = Text1.Text
        .All("password").Value = Text2.Text
        .All("Submit").Click
    End With    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set Form2 = Nothing
End Sub
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 12577425
Change these 3 lines accordingly:

>>.All("loginID").Value = Text1.Text
>>.All("password").Value = Text2.Text
>>.All("Submit").Click

means in your HTML form , must got elements of "loginID" , "password" and a submit button named as "Submit" . You need to change it accordingly.

Hope this helps
0
 

Author Comment

by:chrisyroid
ID: 12577445
I laso want to know how to do this with asp
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 12577458
>>I laso want to know how to do this with asp
It's all depends on your web page design whether you want to have a popup login window or not, basically, you can directly put the login form into the web page, and hence a popup login window is NOT necessary.

For futhermore, you can try post a separate question on this issue, since:

* It's consider a New question as it's different from what you asking
* The popup login window issue should ask on ASP/ Javascript TA.

regards
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 12577633
Here is the basic login form, login.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript">
      function validate(frm) {
            if (frm.loginID.value == "") {
                  alert("Please enter your username.");
                  frm.loginID.focus();
                  return false;
            }
            if (frm.password.value == "") {
                  alert("Please enter your password.");
                  frm.password.focus();
                  return false;
            }
            return true;
      }
</script>
<body>
<form name="form1" method="post" action="process.asp" onSubmit="return validate(this)">
  <h2><strong>User Login</strong></h2>
  <p>Username:
    <input name="loginID" type="text" id="loginID">
  </p>
  <p>Password:
    <input name="password" type="password" id="password">
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Reset" value="Reset">
  </p>
</form>
</body>
</html>

Try customize it accordingly.

Also, try close your new open thread, i thought you mean create a totally new form... sorry if that bring misunderstanding..
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question