Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to automatically fill the data got from website1 to website2? 1

Status
Not open for further replies.

11251995

Programmer
May 18, 2005
12
US
To avoid user copy the info (i.e. name, dob, ssn etc) from website1 and fill to another website2's form manually all the time, I'd like to use some kind of javascript to grab the info in website1 and automatically fill the form in the website2.

I am developing/own website1 while website2 is another public website which I do not own.

Is this feasible? Any hint? Thanks a lot!!!!
 
You can't access another site like that. You may be able to submit directly to the other site's form handler to bypass their form. Is that an option?

Otherwise, you may have to rely on the user's browser's autocomplete feature.

Adam

There are only 10 types of people in the world: Those who understand binary, and those who don't
 

This is not feasible at all. There is no support for this kind of thing... and security rules actively work against such a possibility. Give up the idea and move on.

Hope that saved you hours of work!

Cheers,
Jeff

 
Hi Adam0101,

Thanks for your input. Here is my working around code:

<script LANGUAGE="JavaScript">
var newWindow;

function fillData(){
newWindow.document.form[1].subSSN.value=300895489;
newWindow = window.open(' 'aWindow', '');
newWindow .focus();
return false;
}
</script>

<td>
<a href="" onClick="javascript: newWindow = window.open(' 'aWindow', ''); emomedWindow.focus(); return false;">[Link to ABC]</a>
</td>

<td>
<a href="" onClick="fillData()">[Capture data]</a>
</td>

Is there anything worng? I am new in javascript, please help. Thanks a lot.
 
No no, you can't use JavaScript across domains! I meant that you might be able to make a copy of their form and submit it directly to their form handler. So if their form looks like this :
Code:
<form action="formHandler.asp" method="post">
<input type="text" name="query">
</form>
You could recreate it on your page like this:
Code:
<form name="hiddenForm" action="[URL unfurl="true"]https://www.ABC.com/formHandler.asp"[/URL] method="post">
<input type="[red]hidden[/red]" name="query">
</form>
Then fill it in and submit it:
Code:
<script>
document.hiddenForm.query.value='whatever';
document.hiddenForm.submit();
</script>

Do not attempt to create their form on your site verbatim without getting their permission, though. That'd be a violation of copyright laws.

Adam

There are only 10 types of people in the world: Those who understand binary, and those who don't
 
Thank you so much adam0101!

I did what you suggested as the following:

<a href="" onClick="javascript: aWindow = window.open(' 'aWindow', ''); aWindow.focus(); return false;">[Link to ABC]</a>

<a href="" onClick="fillData()">[Capture data]</a>


<form name="hiddenForm" action=" method="post">
<input type="hidden" name="subID" value="nnnnnnn">
<input type="hidden" name="subSSN">
</form>

<script LANGUAGE="JavaScript">
function fillData(){
document.hiddenForm.subSSN.value='123456789';
document.hiddenForm.submit();
}
</script>

But I have trouble to mimic the submit button action since in its source, it defineds like this:
<input type="Button" VALUE="Submit" onClick="submitAction(this.form)" onFocus="getMessage(this,blankMsg)">

So, document.hiddenForm.submit(); does not work. Do you know how can I solve this?

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top