Reference numbers on forms

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I am trying to set up a property website and I am having
problems with a form. When a visitor finds a property
they can click on a request more info button which will
hyperlink to a form I want this form to automatically
contain the reference number of the property they have
just clicked on. Does anybody have any ideas. Please
mail me at (e-mail address removed) with your replies
and thanks in advance for your help
 
-----Original Message-----
I am trying to set up a property website and I am having
problems with a form. When a visitor finds a property
they can click on a request more info button which will
hyperlink to a form I want this form to automatically
contain the reference number of the property they have
just clicked on. Does anybody have any ideas. Please
mail me at (e-mail address removed) with your replies
and thanks in advance for your help

First, append a query string to each URL that points to
your form page; for example:

<a href="moreinfo.htm?propid=1234">

where 1234 identifies the property. Then, add the
following script to the <head> section of the form that
you want to receive the value:

<script>
function qsobj (){
var qvbl;
var qstring = "" + document.location.search.substring(1);
if (qstring != ""){
var qpairs = qstring.split("&");
for (i=0; i < qpairs.length; i++) {
qvbl = qpairs.split("=");
this["" + qvbl[0]] = unescape(qvbl[1].replace
("+"," "));
}
}
}
function getqsvar(qsvar){
if (qstr[qsvar] == null){
return "";
}else{
return qstr[qsvar];
}
}
var qstr = new qsobj();
</script>

</head>

Finally write some JavaScript that assigns the value of
getqsvar("propid") to the form element you want. For
example, to put the value in a text box named property,
you would add this code just before the </form> tag:

<script>
property.value = getqsvar("propid");
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*========----------
|\=========------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/=========------------
*========----------
 
Back
Top