Skip Navigation

[Resolved] Apostrophe in name breaking my code

This support ticket is created 7 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Shane 7 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#443851

I am trying to: Show the telephone

I visited this URL: hidden link

Using this code to show the telephone, I get well the result desired, except if the is an apostrophe on the name.

The idea is to create an event with the name of the user on Google analytics as soon as the click on "Afficher le téléphone"

It works perfectly unless there is an apostrophe ( ') on the name... Is there a way to avoid [types field="nom"][/types] to break my code when there is as apostrophe ( ') in it ?

Right now the page is working well, because I changed the apostrophe ( ') for (`).

Thanks in advance for your help.

<div><a onclick="ga('send', 'event', 'Afficher le téléphone', '[types field="prenom"][/types] [types field="nom"][/types]', '[types field="telephone"][/types]', '0');document.getElementById('[types field="ordre-affichage" output="raw"][/types]').style.display='';return false;" 
href=""><img class="alignleft size-full wp-image-2931" src="<em><u>hidden link</u></em>" alt="Téléphone Finaxim" width="29" height="20" /> Afficher le téléphone</a>
    
    
<div id="[types field="ordre-affichage" output="raw"][/types]" style="display:none;margin:15px 0;">
<b>Tel :</b> <span itemprop="telephone">[types field="telephone" separator=" - "][/types]</span><br/>
[wpv-conditional if="( $(wpcf-fax) ne '' )"]<b>Fax :</b> [types field="fax"][/types][/wpv-conditional]</div></div>
#443921

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Miguel,

Thank you for contacting our support forum.

Could you let me know how exactly this breaks and what is the output when it breaks ?

Looking forward to hearing from you soon.

Thanks,
Shane

#445855

Hi Shane

Thank you for your help..

When you click on "Afficher le téléphone", it doesn't show the telephone like it should.

hidden link (password : 123)

This one works well

hidden link

#445931

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Miguel,

I'm looking at the page and wasn't able to see the problem.

Could you replicate or maybe i'm not seeing it clearly.

Is there a screenshot that you can send so I can better understand ?

Thanks,
Shane

#446069
3.jpg
2.jpg
1.jpg

HI Shane

I'm sending you a couple screenshots. On the third one I'm showing you the code... as a matter of fact when I have an apostrophe in the name "Afficher le téléphone" doesn't work.

In this case 'Emmanuel d'premont' , my question is : Is there any way I can call the name without the apostrophe? 'Emmanuel dpremont'

<a onclick="ga('send', 'event', 'Afficher le téléphone', 'Emmanuel d'premont', '0123456789', '0');document.getElementById('300').style.display='';return false;" href=""><img class="alignleft size-full wp-image-2931" src="<em><u>hidden link</u></em>" alt="Téléphone Finaxim" width="29" height="20"> Afficher le téléphone</a>

Thanks a lot

Miguel

#446353

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Miguel,

This onclick event was added by you correct?

What you can try doing is using double quotes on the outside and single quotes within like this -> "Emmanuel d'premont"

Please let me know if this helps.
Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.