Sorry Frank, missed your earlier reply, will read now
Conclusion for now,
I am not a web developer,
Wish webform builder had an easy function to import a query string
But will look further and learn along the way.
Christian
I am not a web developer,
Wish webform builder had an easy function to import a query string
But will look further and learn along the way.
Christian
I cannot test it, but the following should work to put the number in a Web Form Builder hidden field.
1. In the web page on a PHP enabled server, set up the form with Web Form Builder including a hidden field with the name hidnum, and a random value, say 000000.
2. Make the body element of the page as <body onload="picnum()">
3. At the foot of the page (immediately before the closing body tag) enter
<script>
function picnum() {
var x = location.href.slice(-6);
document.getElementsByName("hidnum")[0].innerHTML = x;
}
</script>
Access that web page with a browser, but add #123456 or # followed by any number to the URL and see whether that number is the number in the hidden field.
Frank
1. In the web page on a PHP enabled server, set up the form with Web Form Builder including a hidden field with the name hidnum, and a random value, say 000000.
2. Make the body element of the page as <body onload="picnum()">
3. At the foot of the page (immediately before the closing body tag) enter
<script>
function picnum() {
var x = location.href.slice(-6);
document.getElementsByName("hidnum")[0].innerHTML = x;
}
</script>
Access that web page with a browser, but add #123456 or # followed by any number to the URL and see whether that number is the number in the hidden field.
Frank
Hey Frank,
By the way, appreciate the help !
I've added the few lines and tried it out:
https://titeca.biz/test/webform.php#000000
But the number displayed in the confirmation page (fotonr) is the one I added in webform builder default value.
christian
line added at the start
<body onload="picnum()">
code added as you said before </body>
<script>
function picnum() {
var x = location.href.slice(-6);
document.getElementsByName("fotonr")[0].innerHTML = x;
}
</script>
When inspecting the page I also see this error:
Uncaught TypeError: Cannot set properties of undefined (setting 'innerHTML')
at picnum (webform.php?action=confirmation:35:51)
at onload (webform.php?action=confirmation:17:26)
Christian
By the way, appreciate the help !
I've added the few lines and tried it out:
https://titeca.biz/test/webform.php#000000
But the number displayed in the confirmation page (fotonr) is the one I added in webform builder default value.
christian
line added at the start
<body onload="picnum()">
code added as you said before </body>
<script>
function picnum() {
var x = location.href.slice(-6);
document.getElementsByName("fotonr")[0].innerHTML = x;
}
</script>
When inspecting the page I also see this error:
Uncaught TypeError: Cannot set properties of undefined (setting 'innerHTML')
at picnum (webform.php?action=confirmation:35:51)
at onload (webform.php?action=confirmation:17:26)
Christian
Here's a PHP way.
https://www.coffeecup.com/forums/web-fo … post292935
https://www.coffeecup.com/forums/web-fo … post292935
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
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
Thanks for trying, Christian.
It looks as though the onload attribute in the body tag is triggering the script too soon, i.e. before the form elements load.
It looks as though Eric may have a much better way anyway*.
Regards,
Frank
* I would otherwise have suggested removing the attribute in the body tag and adding before the closing script tag
window.load = picnum;
It looks as though the onload attribute in the body tag is triggering the script too soon, i.e. before the form elements load.
It looks as though Eric may have a much better way anyway*.
Regards,
Frank
* I would otherwise have suggested removing the attribute in the body tag and adding before the closing script tag
window.load = picnum;
I'll try Eric's solution,
but not this evening ;-)
THANK YOU
but not this evening ;-)
THANK YOU
Here's a js solution.
Link setup
https://mysite.com?name=test
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const Name = urlParams.get('name');
document.getElementById('name').value = Name;
</script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const Name = urlParams.get('name');
document.getElementById('name').value = Name;
</script>
Link setup
https://mysite.com?name=test
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
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
Thank you Eric.
Will try that today.
Christian
Will try that today.
Christian
Hello Eric,
My hidden field is: fotonr with a default value of 123212 (just randomly choosen)
I changed the variable name in your example to fotonr and use the link:
https://titeca.biz/test/webform.php?fotonr=111111 (random value for testing)
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const Name = urlParams.get('fotonr');
document.getElementById('fotonr').value = fotonr; (Is this the webform document and hidden variable name?)
</script>
I placed this script at the bottom before the end body tag in the webform.html file
But I do not see the fotonr field being changed to 111111
What am I doing wrong?
There is no body onload parameter to add I guess?
Or perhaps the script needs to be placed before the body tag?
Thank you for your advice,
Christian
My hidden field is: fotonr with a default value of 123212 (just randomly choosen)
I changed the variable name in your example to fotonr and use the link:
https://titeca.biz/test/webform.php?fotonr=111111 (random value for testing)
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const Name = urlParams.get('fotonr');
document.getElementById('fotonr').value = fotonr; (Is this the webform document and hidden variable name?)
</script>
I placed this script at the bottom before the end body tag in the webform.html file
But I do not see the fotonr field being changed to 111111
What am I doing wrong?
There is no body onload parameter to add I guess?
Or perhaps the script needs to be placed before the body tag?
Thank you for your advice,
Christian
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.