• Resolved stefanchristopher

    (@stefanchristopher)


    I am a complete novice when it comes to web coding and would very much appreciate some help.
    I am looking to generate a URL that changes based on what someone writes or selects in the input fields on the form.
    I can generate the URL but I need whoever uses the form to be able to copy the generated url and paste it into an email. At the moment you can copy the URL but because there are spaces in it it doesn’t work when copied to an email.
    I really need to be able to automatically encode the URL so that all the spaces and special characters are replaced with ASCII characters.
    The icing on the cake would be to add a Copy URL button too so that the person using the form wouldn’t have to select the URL and copy it.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @stefanchristopher

    You are using the generateURL operation in the wrong way, the correct would be:

    
    generateURL("https://weareclearhead.com/contractor-agreement/", {pcode:fieldname5, rate:fieldname6, job:fieldname8+fieldname7})
    

    Best regards.

    Thread Starter stefanchristopher

    (@stefanchristopher)

    Thanks for replying. When I use that code it gives me nothing in the Generated custom URL box.

    Plugin Author codepeople

    (@codepeople)

    Hello @stefanchristopher

    I’ve tested your form again, and you are not using the recommended code.

    Best regards.

    Thread Starter stefanchristopher

    (@stefanchristopher)

    I do apologise, I definitely, definitely tried it and it didn’t work and now I’ve tried it again and it works precisely how I need it to.

    Any chance of helping me out with the copy to clipboard button?

    Plugin Author codepeople

    (@codepeople)

    Hello @stefanchristopher

    I’m sorry, I but don’t understand the reason why you need to store it in the clipboard.

    Best regards.

    Thread Starter stefanchristopher

    (@stefanchristopher)

    It’s ok I’ve figured that part out now from an answer you gave to a question on another question.

    The reason is because people using this form will copy and paste the generated URLs to contractors who want to work with us. The URL automatically populates another form elsewhere on the website that the contractor needs to fill in and sign before they can work with us.

    The code you provided before works well but the spaces are now replaced with “+” and when the contractor opens the generated URL the fields are automatically populated with the right info but with +’s instead of spaces. Is there any way to get the generateURL function to substitute spaces with %20 instead of + ?

    Plugin Author codepeople

    (@codepeople)

    Hello @stefanchristopher

    The “+” symbol is the correct one in the query strings.

    I don’t know why you need to copy and paste the URL instead of redirect the user from the form. Please, follow the instructions below:

    1. Untick the “Eval dynamically the equations associated to the calculated fields” in the “Form Settings” tab.

    2. Edit the equation as follows:

    
    redirectToURL("https://weareclearhead.com/contractor-agreement/", {pcode:fieldname5, rate:fieldname6, job:fieldname8+fieldname7})
    

    3. Finally, select the “Calculate” option for the “type” attribute in the button’s settings

    Best regards.

    Thread Starter stefanchristopher

    (@stefanchristopher)

    I did mention before the reason why I needed a copy to clipboard button. This form will be used by staff to generate URLs to paste into emails to contractors who want to work with us. I didn’t need our staff to be redirected to the generated URL at all.

    Thread Starter stefanchristopher

    (@stefanchristopher)

    So basically using your original suggestion I can generate the URLs to look like this. All spaces have been replaced with + and all other special characters are replaced with the correct ASCII codes.

    See image: here

    So then one of our staff members would paste this URL into an email to a contractor that wants to work with us.

    When the contractor clicks the link in their email, they will be taken to the contractor agreement form but it looks like this. But what I really need is for the +’s to be actual spaces.

    See image: here

    Plugin Author codepeople

    (@codepeople)

    Hello @stefanchristopher

    In this case, you can reimplement the equation as follows:

    
    generateURL("https://weareclearhead.com/contractor-agreement/", {pcode:fieldname5, rate:fieldname6, job:fieldname8+fieldname7}).replace(/\+/g, '%20');
    

    Best regards.

    Thread Starter stefanchristopher

    (@stefanchristopher)

    Thanks @codepeople

    That’s exactly what I needed!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Generate encoded URL with ASCII characters’ is closed to new replies.