Solved

pre-populating web pages

Posted on 2004-10-20
15
592 Views
Last Modified: 2010-04-06
Is it possible to link to a site and prepopulate fields on their home page without passing parameters.
Our website is linking to a business partner's website and would like to pass information to their home page and prepopulate certain fields.
They cannot allocate resource to amend their site to accept parameters.

I have seen this done with some web sites and I think that they did this using java applets. I just wondered if anybody had done something similar with applets or other development software and could point me to any useful documentation.
0
Comment
Question by:rexjohnson
  • 3
  • 3
  • 2
  • +4
15 Comments
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
There are many ways (cookies, query string parameters as you said, active scripting reading data files, database retrieval, and so on) this can be achieved, but if your business partner cannot (or will not) amend their site accordingly to accept the parameters, then perhaps the only method is by using an "input recording" software product that tracks your interaction (mouse movements, clicks, scrolling, typing, button pressing, etc) with your environment and can then "replay" this in the future to emulate what you did manually on the previous occasion.

BFN,

fp.
0
 

Author Comment

by:rexjohnson
Comment Utility
This is fine if you are trying to achieve populating a web site from a browser under your control (in fact we do this as part of our business process) but what we are trying to do here is customer orientated.

The customer navigates our site and we have software that will take their input and populate partner web sites with this data.

At a later point in the web process we direct the customer to a partner's site where currently they need to reenter key details. What we want to do is prepopulate those key details on the partner's web site.
0
 
LVL 3

Expert Comment

by:PaulPosition
Comment Utility
Hmmm, one way I can see, but its sort of a 'hack' and depends a lot on your partner's form validation implementation, would be to submit your information to the receiving script. If the latter has been well coded, it should return you to the form (actually, not *return* since you have skipped that part) with some error messages stating what fields haven't been populated.

For example, if your partner's site 'GETs' email, firstname and lastname information to 'formprocess.php', and YOUR form has room for a name and firstname fields, **MAYBE** linking to 'formprocess.php?name=MyName&firstname=MyFirstName' will get you to the form page with 'name' and 'firstname' already populated but 'email' being left empty and a message telling the user something like 'Email field is a required field'.

Of course, that depends a lot on your partners implementation. Maybe try logging to their form and seeing what happens when a few field aren't set. If the resulting page is too disorienting to a user, forget it, but if it brings up the form with nice 'Warnings: This field is required information' or such, it could be a good workaround that doesn't involve java applets or other software running on the client side.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
The correct way to do it is to handle it on your server. Setup the links on you pages that get the partner pages to point at a script on yur server.  Then go server to server to bring in the page, and you can do whatever you need ot do before returning it to the user.

Cd&
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
...so you are offering a "valued added" front-end to various partner "back end" web sites, and in order to obtain data from the partners you populate their web form-based fields, submit to their server(s), and scrape the results back to your site?  But later in the process, the same data needs to be re-input into form-based fields as a verification check?

It really sounds like you need a bespoke communications channel to the partners' servers (as discussed by Cd&).

However, I guess what your partners are saying is that they cannot justify the expense of allocating a resource.

Depending on the revenue your "value added" service generates, could you not offer to fund a resource for your respective partners?

What technologies are used?  Perhaps this would give us a better idea at suggestions?

BFN,

fp.

0
 
LVL 8

Assisted Solution

by:sigmacon
sigmacon earned 125 total points
Comment Utility
If its possible, PaulPosition's solution would be the most elegant: Linking to yout partner's site using url paramters. But, if you are sending personally identifying data, there are privacy/security concerns. Submitting a form from your site to your business partners site would be another solution, but with similar security implications. So, if all that is not an option, there is a possibility to achieve what you are trying to do using whatever system/language you run on your webserver and javascript on the client. Downside of this solution is, of course, that it depends on the client having javascipt enabled, which is the case for over 98% of the visitors most sites see.

Here is how it would work: You generate a page that has your customers data embedded in an appropriate piece of dynamically created JavaScript. This script opens a new window, loads your business partners website and populates the fields in that form using JavaScript. Of course you will need to know the exact names of all form fields in your partners page, which can be determined by lookind at the source of the page. Everytime they change their form, you will have to change your script.

Another, VERY RESOURCE-intensive hack would be to perform a backend http request to your business partner's website and serve it as if it is part of yours. But this is a very big and ugly hack (it does work though, albeit being slow and cumbersome to implement).

If you want code samples, please provide more information about what software you are using.
0
 

Author Comment

by:rexjohnson
Comment Utility
We are using java jsp/servlet technology for our web site running under websphere 5.

I like the idea of simulating the form input to heading directly into the back end process that deals with the form but I think that this would probably still involve our partners although perhaps not to the  same extent as the parameter processing solution.

I would like the code samples for a javascript solution from sigmacon. We try to minimise the javascript we because it can be disabled and also because of the variations on different browsers but in the case of this javascript not working the customer would still be able to enter their key details manually.

Thanks for the ideas

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 18

Accepted Solution

by:
arantius earned 125 total points
Comment Utility
Online demo here, including faked 5-second delay to show the onload delay works properly: http://www.arantius.com/ee/Q_21175107.html

Two files: Q_21175107.html and Q_21175107b.php .  The php file represents the remote site, the html file you would make.  Here are my examples followed by explanation:

Q_21175107.html:
<html>
<head>
<script>
function fillOtherForm() {
      window.frames.b.document.forms.otherForm.textField.value="abc";
}
</script>
</head>

<frameset rows="*" onload="javascript:fillOtherForm();">
      <frame src="Q_21175107b.php" name="b">
</frameset>

</html>


Q_21175107b.php:
<html>
<head>

</head>
<body >

This is a test... the page should load in around 5 seconds.
<?
flush();
sleep(5);
?>

<form name="otherForm">
<input type="text" name="textField"><br>
<input type="submit">
</form>

</body>
</html>

The html file above puts the "remote site" in a frame, and attaches a javascript function to the onload event of that frameset.  This makes sure that the forms in that page will be loaded when we try to populate them.
The function it calls references "window.frames" and inside that b, the name of the inner frame, then the form element as usual, assuming names on the form and the form element, and assigns it a value.

The PHP file is not terribly important, as it is just an example and in reality you are saying you have no control of it.  I just wrote it up to include the PHP call to sleep() to simulate a page that takes a few moments to load, to make sure it all still worked.
0
 
LVL 8

Expert Comment

by:sigmacon
Comment Utility
arantius showed essentially what I suggested, instead of using frames I would use, in JavaScript:

var newWindow = window.open( ...
and then refer to the form fields with newWindow.document.forms ...

But either way would work. The advantage of arantius' approach is that it would still show your partners page, even when JavaScript is disabled. In my solution, you page would simply provide another link to your partners page within a <noscript> tag.
0
 

Author Comment

by:rexjohnson
Comment Utility
I have tried the solution from Arantius and while this works when you are populating a page in the same domain it does not work with cross-domain population - it gives an access error.

I believe you could do this type of thing with old versions of I.E. but they introduced this block as a security measure

0
 
LVL 8

Expert Comment

by:sigmacon
Comment Utility
You are right about that, permissions in newer browsers usually prevent this cross-site scripting. The next possible solution then would be something similar to what Paul suggested:

Build a copy of your business partners form on your side, populate it with the appropriate form values - making sure that there is at least one error in the form that prevents it from just being accepted as completed by the other site, if that's what you want - and do something like this in the body of the page you generated:

onload="javascript:document.forms['nameOfForm'].submit()"

The action attribute in your form tag points to your business partner's page handling the form submission. Pre-populate the form fields simply by setting the value="..." parameter for each form field. I have done this kind of form submission based on data from a site I worked on to someone else site often and it works, no matter whether they use GET or POST as their methods. You may want to make all form fields hidden, so that the user is not necessarily disturbed by your hacking their personal information away across the net ... ;-)

You may also just give them a submit button, informing them that by pressing the submit button, they will and their personal information will be forwarded to another site. If you do that, you don't even need JavaScript.
0
 
LVL 18

Expert Comment

by:arantius
Comment Utility
"with cross-domain population - it gives an access error."

Whoops!  I had intended to test that but forgot once I had it finished.  Too bad!
0
 
LVL 13

Expert Comment

by:davidlars99
Comment Utility
Simple [Web Service] should take care of what you are trying to accomplish I think
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
split sigmacon and arantius. They brought it as close as it can get within the contraints of the requirements.  IMHO.

Cd&
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now