Prepopulating form fields with data containing "+" sign does not work

  • timetric
    Asked on June 29, 2015 at 10:10 AM

    Using the technique on http://www.jotform.com/help/71-Prepopulating-fields-to-your-JotForm-via-URL-parameters I am trying to prepopulate some fields on my forms.
    Some of these fields are phone numbers in international form, eg +44 1234 567890

    However, when I encode these like so;

    http://form.jotformeu.com/form/FORMID?telephoneNumber=%2B441234567890

    the "+" sign never appears. It seems to work fine with any other special character I use, but the plus sign is swallowed/turned into a space.

    Toby

  • Mike_G JotForm Support
    Replied on June 29, 2015 at 1:02 PM

    I can see what you mean as I have reproduced the issue. Normally, the "%2B" should be working, but it is not. I will forward this to our developers for them to take a look at it. I would like to apologize for the inconvenience. You will be receiving updates regarding this concern via this thread. Thank you. 

  • timetric
    Replied on June 30, 2015 at 7:06 AM

    Thanks. It would be good to understand if this will be solved in the next day or two: this is the only blocker to me paying for a full account for a campaign we need to run.

    Thanks,

    Toby

  • AaronSiciliano
    Replied on June 30, 2015 at 11:03 AM

    Hello timetric,

     

    This appears to be intended behavior for the script. It parses the symbol and replaces it with a space. I am not personally aware of the reason the plus symbol is not allowed in the url prepopulating form script but the developer confirmed that it is operating as intended.

     

    Thanks,

    Aaron

  • timetric
    Replied on June 30, 2015 at 11:08 AM

    Ok - so what is the recommended way to prepopulate the form with data including a "+" sign?

     

    I don't think this is a particularly weird thing to do - as in my example, it's the standard way to do international phone numbers, which are a fairly common thing to put in a form field.

     

    Toby

  • Sammy
    Replied on June 30, 2015 at 1:20 PM

    Hi Toby,

    As a workaround you can pass the number to a hidden field without a plus then use condition to update the phone field with the hidden value while appending the +sign in the condition evaluator.

    A point to note, when addint the plus symbol do not type it directly it will be evaluated to a mathematical operation instead add it within single quotes '+'  then remove the quotes one at a time that way the symbol will remain as text.

    Prepopulating form fields with data containing + sign does not work Image 1 Screenshot 70

    Prepopulating form fields with data containing + sign does not work Image 2 Screenshot 81

    Prepopulating form fields with data containing + sign does not work Image 3 Screenshot 92

    Prepopulating form fields with data containing + sign does not work Image 4 Screenshot 103

     

    Prepopulating form fields with data containing + sign does not work Image 5 Screenshot 114 

    Prepopulating form fields with data containing + sign does not work Image 6 Screenshot 125

     

    Kindly revert back with your results.

     

  • timetric
    Replied on July 1, 2015 at 11:22 AM

    Thanks for this response. I think this would work for the simple phone number case. This might be enough to get me going for the time being.

     

    Unfortunately it is not a complete solution; some of my telephone field data uses parentheses around the international code - eg "(+44) 1234 567890" - and there is no clear condition I can write that will work universally.

     

    I would very much rather have the prepopulated field feature working straightforwardly as documented on this one - it would make my life much easier in the future.

     

    If it helps your developer; I do understand that "+" signs have a special meaning in URLs, and I can understand why this feature works as it does currently. However, your service works correctly work with an escaped ampersand (%26) or an escaped hash (%23) - this already makes you better than Wufoo! - it should be possible to read "%2B" and convert it to a "+" in the context of the page - *without* also converting it through to a space.

  • Mike_G JotForm Support
    Replied on July 1, 2015 at 1:55 PM

    How would you like to consider using the Phone Number field instead of a normal text box field to collect phone numbers?

    Prepopulating form fields with data containing + sign does not work Image 1 Screenshot 60

    Adding Phone Number field doesn't include Country Code field automatically, but you can add it through its Properties.

    Prepopulating form fields with data containing + sign does not work Image 2 Screenshot 71

    This would also allow submitters to easily identify what you want for them to enter. 

    Then, pass the value of each field of the Phone Number field to another form via URL using the Thank You page Wizard Custom URL option.

    Here's a sample URL:

    http://FORM URL HERE?countryCode={phoneNumber:country}&areaCode={phoneNumber:area}&phoneNumber={phoneNumber:phone}

    Note: countryCode, areaCode and phoneNumber are field names of the second form.

    {phoneNumber:country}, {phoneNumber:area} and {phoneNumber:phone} are separated values of the Phone Number field of the first form.

    On the other form,

    You need to have fields that will collect each value. And these fields should be hidden. 

    Prepopulating form fields with data containing + sign does not work Image 3 Screenshot 82

    Then, create your condition: 

    Prepopulating form fields with data containing + sign does not work Image 4 Screenshot 93

    As for the result:

    Prepopulating form fields with data containing + sign does not work Image 5 Screenshot 104

    Even if submitters enters the Country Code as (789), +789, (+789) or just 789 it will still have the same result. 

    By the way, here are the two sample form I have used, please feel free to clone it for your reference.

    FORM 1: http://form.jotformpro.com/form/51794542211957

    FORM 2: http://form.jotformpro.com/form/51794945050965

    I hope this helps. Let us know if you need any further assistance. Thank you. 

  • digitalbridge
    Replied on February 23, 2016 at 11:03 AM

    hi,

    not sure if it is ok to respond to this or if I should open a new discussion. How would something like this work with email addresses? Sometimes people will use a + at the end of their email address to filter mail (ie: example+jotform@example.com). We can't really use your hidden field trick for this and it's crucial that  we correct the correct email. Have there been any process changes on this?

     

    Thanks