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 8279919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:29:07+00:00 2026-06-08T09:29:07+00:00

I have a simple HTML form with a username and password. This HTML form

  • 0

I have a simple HTML form with a username and password.

This HTML form contains a login for both free and paid users. Paid users need to enter a username and password, while free users have to enter default usernames e.g. Username = myname, and Password = password.

I managed to auto populate the values of the form using an HTML link –

<a href="#" onclick="document.getElementById('name').value='myname';document.getElementById('password').value='mypassword';" >Free User</a>

This worked smoothly. Now I would like to add the possibility that when the Free User clicks the button, the values are auto populated as above and the said HTML form is submitted immediately.

When I tried it using various methods, the fields would populate but the HTML form will not submit.

Thanks you.

  • 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-08T09:29:09+00:00Added an answer on June 8, 2026 at 9:29 am

    Just set the defaults in the form, no script required:

    User ID: <input type="text" name="userid" value="guest">
    <br>
    Password: <input type="password" name="password" value="password">
    <br>
    <input type="submit" value="Login">
    

    If you really really must use script, then (noting that a form control with a name of “name” will mask the form’s name property so I’ve used something more suitable) use something like:

    <input type="button" value="Guest Login" onclick="
      this.form.userid.value = 'guest';
      this.form.password.value = 'password';
      this.form.submit();
    ">
    

    But frankly it’s a complete waste of time. If you put two submit buttons in the form, one for guests and one for registered users, then guests can click the guest submit button.

    <input type="submit" name="registeredLogin" value="Registered User Login">
    <input type="submit" name="guestLogin" value="Guest User Login">
    

    Whichever button is clicked will be sent to the server so it can set appropriate permissions. If they’ve clicked the guest button, you don’t care what value they set for username or password, just ignore it.

    Again, zero script required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple password reset form that has a username field, and below
I have a simple form which is like this: The HTML: <form action=post> <input
I have a simple form for a login, and I want to display the
I would like to have a simple login form (or any form for that
I have a simple form that's supposed to enter submissions in a MySQL database
I have a simple login form and it does return the success text in
I have created a Django app. I have a registration page(simple HTML form) in
I am trying to create simple user registration form. I have an index.html file
This is a simple form for submitting a listing into a database of real
I need to have a custom authentication in spring, it should be a simple

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.