Pass default value to FP Form?

D

DJ

Hello:

I want to be able to pass a value to a FrontPage form via the URL. I have an
application that collects some user data, for example, the user's first
name. I want them to complete an online form later; since they've already
typed the data in, I'd prefer to recycle it. Is there a way to construct a
URL that includes the value for one or more of the form fields? Something
like this...

http://www.mydomain.com/form.html?uname=john

Is this possible?

Thanks in advance for your replies...

-Dallas
 
D

DJ

Hi, Tom:

Thanks for the link. This is a slam dunk in PHP, but I was hoping it was
achievable in FrontPage as well.
 
T

Tom Gahagan

sorry....i don't know the answer for you but if it can be done in fp someone
here will know about it. I'll dig around tomorrow and see if I can learn
anything.

Tom G
 
S

Stefan B Rusynko

See http://irt.org/script/form.htm#10.3




"DJ" <jones.dallas at gmail.com> wrote in message | Hi, Tom:
|
| Thanks for the link. This is a slam dunk in PHP, but I was hoping it was
| achievable in FrontPage as well.
|
|
| | > This might get you started......
| >
| > http://www.phparch.com/discuss/index.php/m/2879/0/#msg_2879
| >
| > if not, do a google on.... passing a value in a url..... or something like
| > that
| >
| > Best to you......
| > Tom Gahagan
| >
| >
| > "DJ" <jones.dallas at gmail.com> wrote in message
| > | >> Hello:
| >>
| >> I want to be able to pass a value to a FrontPage form via the URL. I have
| >> an application that collects some user data, for example, the user's
| >> first name. I want them to complete an online form later; since they've
| >> already typed the data in, I'd prefer to recycle it. Is there a way to
| >> construct a URL that includes the value for one or more of the form
| >> fields? Something like this...
| >>
| >> http://www.mydomain.com/form.html?uname=john
| >>
| >> Is this possible?
| >>
| >> Thanks in advance for your replies...
| >>
| >> -Dallas
| >>
| >>
| >>
| >>
| >
| >
|
|
 
M

MD Websunlimited

Hi DJ,

In ASP you'd do the following:

<input type="text" name="firstname" value="<%=request.querystring("uname")%> >

A simple dunk in ASP script

=====================

To accomplish using JavaScript you'd parse the location object to extract the params then set the value of the input fields using
either a defered script or the onload event handler of the body tag.

The code:
<script>
aArray = new Array;
aArg = new Array;
document.write('Page passed = ' + window.location + "<p>");
sLocation = window.location.toString();
aArray = sLocation.split('?');
//document.write('<br>Passed Values<br>');
//for (i = 0 ; i < aArray.length; i++) {
// document.write(i + " " + aArray + "<br>" );
//}

// now aArray[1] contains the args
aArray = aArray[1].split('&');
document.write('<br>Parameters<br>');
for (i = 0 ; i < aArray.length; i++) {
//document.write(i + " " + aArray + "<br>" );
aArgs = aArray.split('=');
document.write('Key = ' + aArgs[0] + ' Value = ' + aArgs[1] + '<br>');
if (aArgs[0] == "Name") document.theForm.Name.value = aArgs[1];
if (aArgs[0] == "Address1") document.theForm.Address.value = aArgs[1];
if (aArgs[0] == "Company") document.theForm.Company.value = aArgs[1];
}

</script>

An example using the above may be found at http://www.websunlimited.com/samples/CallPassParam.htm



Have fun, challenge yourself.

--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 102 Components For FP
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible
Download the Trial http://www.microsoft.com/frontpage/downloads/addin/launchupdate/download.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top