Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML - How to pre-populate form field with known value upon load?

Tags:

I have this web page, say Home.html, that has links to other employee-related web sites. There is one, say www.SomeSite.com/HR.xyz, where it has a form to login. There are 3 fields: UserId, Password, and Company. The company is always the same, e.g. MyCo. How can I update the Home.html page so that when the user clicks on the link to , www.SomeSite.com/HR.xyz, it automatically populates the Company field with "MyCo"?

I looked at the DOM and found the following:

<input autocomplete='off' class='loginInput' tabindex='3' type="text" name="company" id="company" value="" maxlength='50' size="25">

I tried the following by entering it in the URL and it did not work (no error, just didn't populated the "company" field: www.SomeSite.com/HR.xyz?company=MyCo.

Thanks for advice!

like image 296
user118190 Avatar asked Oct 29 '10 19:10

user118190


People also ask

How do you auto populate a form field?

Open your PDF form in Adobe Acrobat Pro, choose Prepare Form > Fields and name the field(s) that you need the information to be copied to EXACTLY like the field where the information will be copied from. The system will then mark it with a “#” sign which means that fields are auto-populated. Step 2. Save changes.


1 Answers

Change the value attribute:

<input autocomplete='off' class='loginInput' tabindex='3' type="text" name="company" id="company" value="MyCo" maxlength='50' size="25"> 
like image 50
Seb Avatar answered Sep 22 '22 15:09

Seb