sending URL to webform - Page 1

User 1894811 Photo


Registered User
18 posts

Hello,

I have a simple form asking for a name and the email.

The customer gets the link to the webform and this link has one parameter which is a textfield
How does this work?
Something like http://mywebform/TEXT?textvariable="text"
And does the webformbuilder allows to retrieve a value like that or how is that done?

Thank you for replying,
Christian
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

The link that can be given to somebody will have to be to a website that has a page that displays the form, like e.g. https://mysite.com/formpage.html

On that form page, there will have to be a form with at least two fields: name field and email field. And of course, a submit button.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 1894811 Photo


Registered User
18 posts

Hello, good morning, and yes, that I know how to do.

The idea is as follows.
I am a photographer, taking a picture of someone, printing out a qrcode with a link to the picture that is being uploaded on the spot.
The link could be http://eventpictures/123654.jpg
Now, the picture is free in exchange of some information (name, email) to sign up with a newsletter.
When they scan the qrcode they land on the form which should receive the picturenumber in a hidden text field variable, say %varpictlink% and is not visible.
When they finish filling in the form they are send to the picture link after which they can download the picture.

So, printing the qrcode on location should contain the URL to the webform and one parameter which is the picturenumber.
The form has a hidden text veriable and will then construct the URL to the upload picture.

So, any ideas, let me know please.

Christian
User 122279 Photo


Senior Advisor
14,447 posts
Online Now

Personally, I have no experience with qr codes, so I cannot give you any ideas. And none of the apps from Coffeecup Software has any feature like this.
But if you hang in here for a bit, maybe if you're lucky there might be another user who can help you.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 1894811 Photo


Registered User
18 posts

Hey,

Thank you for replying.
It really does not have anything to do with qrcodes.
Rather how to send a parameter within the URL that leads to the webform online that can read in that parameter (just text or a number) in a hidden variable within that form.
That's all.

Christian
User 379556 Photo


Registered User
1,533 posts

Part of the matter might be achieved by pretending that there is an id in the page to which the QR code directs.

e.g. QR code directs to
https://eventpictures/formpage.html#123456

When it gets to that page, no ID is found called "123456", but a tiny piece of JavaScript can read what that attempted anchor was. Something like the following would demonstrate this.

Make the body tag of https://eventpictures/formpage.html as follows: <body onload="picnum()">

Put a script in the page as follows:
<script>
function picnum() {
var x = location.href.slice(-6); alert(x);
}
</script>

I thought doing the above might lead to an error page, but it seems not to. It still needs someone here to work out how to proceed with the Web Form Builder use of the picture number identified as above.

Frank
User 1894811 Photo


Registered User
18 posts

Thank you Frank.
That seems to be a way forward.
All the rest I know how to do.

Is it possible using queries ?
like: http://eventpictures.com/webform.php?va … turenumber
And if so, how would you read in the picturenumber ?

Christian
User 1894811 Photo


Registered User
18 posts

Another solution I found on the web:

function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}​
And this is how you can use this function assuming the URL is, http://dummy.com/?technology=jquery&amp … byexample:

var tech = GetURLParameter('technology');
var blog = GetURLParameter('blog');`
User 379556 Photo


Registered User
1,533 posts

My simple suggestion used alert(x) simply to demonstrate that it worked. One could place the result in any element one chose as follows.
1. Create the element into which the number is to be placed, and give it an ID (say, "result").
2. In the code I suggested replace the alert(x); with document.getElementById("result").innerHTML = x;

If there is some advantage to doing it another way, I'm afraid my ignorance of PHP, jQuery and other coding is such that I cannot help with that. Perhaps others may be able to help.

Frank
User 1894811 Photo


Registered User
18 posts

Haven't been able to get it to work yet, not enough knowledge that is for sure.

Embedded the function like this:

<script type="text/javascript" src="common/js/form_init.js" data-name=""
id="form_init_script">

let fotonr = ""
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
var fotonr = GetURLParameter();

</script>

and added this

<body onload="GetURLParameter()">

<!-- Start of the body content for CoffeeCup Web Form Builder -->

and then trying to use variable fotonr but nothing there


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.