Reading a URL Parameter into a field...

User 2327695 Photo


Registered User
2 posts

My client wants to have an email campaign asking customers to fill out a survey to gather some statistics. To entice the customers, there will be a drawing for a gift card.

My idea was to send the email with a link to the survey form with a parameter indicating the account number like:

www.professionaldrivers.com/Survey.shtml?Acct=123456789

I would store the account number in a hidden field then supply that account number in the submittal email.

However I cannot figure out how to set the value of the hidden field to the URL Parameter value, or even if that is possible with the flash web form. I am using the original Form Builder.

Can this be done with the original Form Builder? Can it be done with the new Web Form Builder?

Thanks for your help!
User 2327695 Photo


Registered User
2 posts

It's hard to believe no one has needed this functionality before....

The actual URL parameter I'm testing with is:
http://www.professionaldrivers.com/Surv … 20104-0002

The hidden field is a text field named QUOTE.

I know putting any code in the HTML will be useless as the form gets populated afterwards.

I tried setting the value of the field in the xml:
value="<?php echo $_GET['QUOTE']; ?>"

However, the value field turns out to be blank.

I don't know php, but have tried putting the code in several ares of the php script, but will either get the default value of the hidden field (as defined in the xml) or blank.

Any hints, or suggestions would be greatly appreciated.
User 2655226 Photo


Registered User
5 posts

Hi Martin,

have you find the solution to your question? I'm looking for exactly the same thing.
If maybe have a hint now, it would be really great.
Thanks anyway!

BR,

Igor
User 187934 Photo


Senior Advisor
20,271 posts

Did either of you see this?:)
http://www.coffeecup.com/forums/web-for … rl-string/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 12358 Photo


Registered User
55 posts

Hi Martin,
Looks like there are a couple things conflicting.

There is already code to pre-fill the quote box, which would override when trying to manually display with "$_GET".

There's a portion of javascript that looks for a parameter name 'quo' (not 'QUOTE') and if it's not found (or empty) it will pre-populate the input box with '####' (which is what you're seeing).
So, when it get's to the line where it assigns the "QUOTE" value to 'frmElement2.value', it's "####".

With limited knowledge of everything else going on, I'd say you can try either to use 'quo' instead of 'QUOTE' for the parameter name or alter the javascript to get the value of 'QUOTE'.

The main line to change would be the:
var qValue = getValue("quo");
This is the line that pulls the quote value you're looking for. 'quo' would be the value to be replaced.

The offending script section is in 'pdi_validate.js':
function startSurvey(oForm)
{
var sValue = getValue("sur");
if ( sValue == "" ) sValue = "0004";

var frmElement1 = document.getElementById('SURVEY');
//document.write('Element = ' + frmElement1 + "<br>");
frmElement1.value = sValue;
//document.write('Survey = ' + frmElement1.value + "<br>");

var qValue = getValue("quo");
if ( qValue == "" ) qValue = "####";

var frmElement2 = document.getElementById('QUOTE');
//document.write('Element = ' + frmElement2 + "<br>");
if ( frmElement2 != null )
{
frmElement2.value = qValue;
//document.write('Quote = ' + frmElement2.value + "<br>");
}
return true;
}

User 12358 Photo


Registered User
55 posts

Oh... also, you may want to increase the 'maxlength' attribute for the input box 'QUOTE'. It's currently set at only allowing 4 characters.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.