tags:

views:

51

answers:

5

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!

+1  A: 

You need some way of reading the value passed in the URL on the HR.xyz page. You need to either use Javascript or some server side logic (PHP, .NET, etc)

XSaint32
+2  A: 

Without some kind of scripting (either server side or client side), you will not be able to automatically populate a field in the manner you describe.

Since you do not seem to have access to the source of this site, I would have to conclude that this would not be possible.

Oded
I do have access to our Home site, which is actually in PHP (though I said it was HTML). I do not have access to the destination site, but was able to view the source and found the pasted DOM object. Thanks, any other ideas?
@user118190 - Not really. For security reasons, you will not be able to change defaults on the destination site.
Oded
+1  A: 

Change the value attribute:

<input autocomplete='off' class='loginInput' tabindex='3' type="text"
name="company" id="company" value="MyCo" maxlength='50' size="25">
Seb
I don't have access to that site, i.e. www.SomeSite.com/HR.xyz. I have access to www.MyCo.com/Home.html. Thanks.
A: 

You could try using a get request to populate the input box in the form. That's only if the url like you said is as such www.SomeSite.com/HR.xyz?company=MyCo. In PHP you would simply include:

<input autocomplete='off' class='loginInput' tabindex='3' type="text" name="company" id="company" value="<?php echo $_GET["company"]; ?>" maxlength='50' size="25">

As you can see that within the value attribute is a echo statement that echoes the get request in the URI where HR.xyz?company=MyCo contains the company get request. If you are using just pure html with no scripting language like php the only other method is by having this code:

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

ahmedabdihakim
A: 
Reese Currie