467,163 Members | 1,012 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,163 developers. It's quick & easy.

Auto-Fill Forms By Clicking On Link To Them?

I have a web page that has links to another web page containing a form. Is there any way to pass information to the form fields by clicking on the original link?

For example:

In the original web page, there is a link:
<a href="someurl.html">to_another_page_link</a>

Upon arriving at that page is it possible to have the fields (originally blank) already filled in with the information from the previous page?

(the stand alone form) <input type="text" name="vulntrackval" value="">

(after clicking on link from original page) <input type="text" name="vulntrackval" value="to_another_form_page_link">

Feb 5 '08 #1
  • viewed: 3506
4 Replies
Expert 4TB
Your server side program would need to fill those in before sending it back to the browser. It cannot be done using html alone.
Feb 5 '08 #2
Alright then. That's one convenience they're going to have to do without. Thanks.
Feb 5 '08 #3
Alright then. That's one convenience they're going to have to do without. Thanks.
Not necessarily. Using Javascript its possible to retreive Get query variables using
Expand|Select|Wrap|Line Numbers
  1. function getQueryVariable(variable) {
  2.   var query = window.location.search.substring(1);
  3.   var vars = query.split("&");
  4.   for (var i=0;i<vars.length;i++) {
  5.     var pair = vars[i].split("=");
  6.     if (pair[0] == variable) {
  7.       return pair[1];
  8.     }
  9.   }
  10. }
So for example if you had 2 textboxes on your page (page1.htm), as follows
[HTML]<input id="text1" />
<input id="text2" />[/HTML]

Then you could make your link page1.htm?text1=foo&text2=bar

Then all you need to do is call getQueryVariable('text1') and then for text2 and use javascript to populate your form.

By the way, i cant take credit for the javascript function, i found it at this site

Hope that helps
Feb 6 '08 #4
Expert 4TB
No. You get the query data but then you click the link which gets sent to the server and that's the end of that. The server side software must still populate the next page.
Feb 6 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Manlio Perillo | last post: by
5 posts views Thread by Robert Downes | last post: by
20 posts views Thread by Vijay Kumar R. Zanvar | last post: by
5 posts views Thread by maya | last post: by
22 posts views Thread by nospam_news@wanano.net | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.