Search code examples
javascripthtmlformswufoo

How to prepopulate a wufoo field with an URL?


It seems that Wufoo has a bug because I cannot get to prepopulate a field of my embedded Wufoo form with an url. I am using the javascript embedding method that you can initialize with a 'defautValues' option.

Unfortunately, if I initialize a field with an url (for example: 'defaultValues':'Field1=https://youtube.com'), Wufoo strips 1 slash from the url which makes it invalid.

I tried "urlencoding" the url (for example: 'defaultValues':'Field1=https%3A%2F%2Fyoutube.com') but then wufoo produces an error and does not display the form.

Here is a sample form for you to try and see the behavior by yourself :

<div id="wufoo-mrmifr316ya92y">
Fill out my <a href="https://democratech.wufoo.com/forms/mrmifr316ya92y">online form</a>.
</div>
<script type="text/javascript">var mrmifr316ya92y;(function(d, t) {
var s = d.createElement(t), options = {
'userName':'democratech',
'formHash':'mrmifr316ya92y',
'autoResize':true,
'height':'259',
'async':true,
'host':'wufoo.com',
'defaultValues':'Field1=https://youtube.com', //removes 1 slash (https:/youtube.com)
//'defaultValues':'Field1=https%3A%2F%2Fyoutube.com', //produces an error
'header':'hide',
'ssl':true};
s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js';
s.onload = s.onreadystatechange = function() {
var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
try { mrmifr316ya92y = new WufooForm();mrmifr316ya92y.initialize(options);mrmifr316ya92y.display(); } catch (e) {}};
var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
})(document, 'script');</script>

Do you confirm the bug ? Is there any workaround other than removing the https:// from the field (which is not a very good workaround for me) ?

This question has been asked already here : Why cant I add a URL as a prefilled Wufoo field entry? but as it was not answered, I thought I would ask a more detailed question with an example to actually try the code.


Solution

  • Just received an answer from Wufoo tech support (it was fast for a Sunday question!) :

    Thanks for reaching out. Sorry to hear you're having issues with this. the URL mods do work with the /, but if you put multiple together, it can only display the first one. Sorry for the bad news on that one. I'm afraid there's not a workaround to make that work even if you were to use a different field such as a single line text field.

    What you could do instead is just predefine the field with www.youtube.com rather than http://youtube.com. That way you can still add the website, but it just wouldn't have https in it. Sorry you can't do what you're wanting here. Let us know if you have any other questions.

    Best,

    So it seems this is indeed a bug and that there is no proper way to do it.