Forum Moderators: phranque
The site that my clients page links to for online refills has the following message with a form box
"To enter your pharmacy's Web site, type in the
Pharmacy ID #___________
from your Refill Rx ID Card and press Enter."
is there any script that i can apply to the link that would fill in that ID # automatically when the page opens in a new window?
thanks for any help.
Not sure about IE, but in Netscape if the new window opens from the same domain (or you get permissions for the target domain), I think that window 'aliasing' will work.
Here is a simple example (again, not sure about IE, but you can give it a shot :) ).
Script:
function formFill(targObj, fillVal) {
targObj.value = fillVal;
}
HTML (in old [opener] window):
...
<a href="http://same.domain/PharmID.htm" onclick="var w=window.open(this.href,'PharmID','chrome'); formFill(w.document.getElementById('pharmID'), '1234567'); return false;">Test 1</a>
<a href="http://same.domain/PharmID.htm" onclick="var w=window.open(this.href,'PharmID','chrome'); formFill(w.document.getElementById('pharmID'), '7654321'); return false;">Test 2</a>
...
HTML (in new [target] window):
...
<label for="pharmID">Pharmacy #: </label><input type="text" id="pharmID" name="pharmID"/>
...
Hope that helps.
Jordan
In the page where the user clicks the link to the online pharmacy, have a hidden input field with the same name as the input field for the pharmacy ID on the online pharmacy's page. Use JavaScript to submit the form containing your hidden field to the page which is the action of the form on the online pharmacy's site. Again, it's probably wise to ask permission before doing this.
So if their code looks like this:
<form name="frmPharmID" method="POST" action="getPharmID.jsp">
<input type="text" name="txtPharmID">
</form>
Yours would look like this:
<form name="frmOrderPerscrip" method="POST"
action="http://www.onlinepharmacy.com/getPharmID.jsp">
<input type="hidden" name="txtPharmID" value="1234-th-5">
</form>
<a href="http://www.onlinepharmacy.com"
onclick="document.forms[0].submit();return false;">
Click here to order a perscription</a>
Hope that's sort of useful,
g.