Putting javascript into a field

7 posts by 3 authors in: Forums > CMS Builder
Last Post: March 28, 2008   (RSS)

By steve_e - March 27, 2008

Hi -
I use an email address obfuscater called hivemail enkoder to try to prevent email addresses being harvested from my site (I have to put customer email addresses on the site and I don't want this to result in them getting hugely increased levels of spam).

All it does is convert the email address and a couple more fields (email popup text, email title etc) into a field of gobbledegook, which is translated into an email link by javascript when someone loads the page in their browser.

I'm building the page that is going to include this email address, and I'm having problems getting it to be included properly into a field. If I input it as a wysiwyg field or text box it puts <br /> in at the end of every line. Can anyone suggest a way I can create a field that will exactly implant this code into a page?

Here's what the original looks like:

<script type="text/javascript">

function hivelogic_enkoder(){var kode=
"kode=\";)'':)1-htgnel.edok(tArahc.edok?htgnel.edok<i(+x=edok})i(tArahc.edo"+
"k+)1+i(tArahc.edok=+x{)2=+i;)1-htgnel.edok(<i;0=i(rof;''=x;\\\"=xdeko)}(cd"+
"eCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCoarche.od=k{c+)i+h;gten.ldek"+
"oi<0;i=r(fo';=';x>\\\"\\\\*,=*4,k0jwhq1oghnrw+uDkd1fghnrkBjwhq1oghnrl?.+@{"+
"ghnr00\\\\\\\\0l,w+uDkd1fghnr,..4+lDwdufkh1rg@n{.,~@5l.,>04wkqjohh1rg+nl?3"+
">l@u+ir*>@*>{,%*>,*0=w4qkojhhr1+gDndwfuhkr1Bgwnqkojhhr1?g+n{lh.r@0g00n\\\\"+
"\\\\,l+wDudkf1hgrn.,4.l+wDudkf1hgrn@.{~,5@.l>,40kwjqho1hgrn+?l>3@l+uri>**@"+
"{>%,*_+*lqmr,1h+uvyhuh,1**w+olvsh1rg@nghnr%>g__fp_qr1xuhww+z_lh__%___dk_h?"+
"@#\\\\_ui__________%___do_rpNl|wZ=wdl1jdvoxqkCprwwqdjsyrx1Brx1mnfv@e\\\\\\"+
"\\hw\\\\\\\\HVSp#phhevulk#sri#urVwxdksprw#\\\\\\\\\\\\\\\\Fq_HG__________%"+
"___ww_h#_lo__@__%_______h__do_Np|l_#d__________%___Hd_oANp|l2#Ad_?d__%___>"+
"@__,%_h_rg@n_%hgrn@%ghnr=\\\"\\\\deko\\\"=edok\";kode=kode.split('').rever"+
"se().join('')"
;var i,c,x;while(eval(kode));}hivelogic_enkoder();

</script>

Re: [steve_e] Putting javascript into a field

By Dave - March 27, 2008

Can you set aside a textbox field to use just for this? Is so, edit that field in the field editor and check this under: Field Editor > Advanced Options:

[ ] Disable auto-formatting (don't add break tags to content)

Then try updating the field again.

Let me know if that does the trick.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Putting javascript into a field

By steve_e - March 27, 2008

Aaagh! I was looking for the 'disable auto formatting' option - I use it with AM - but must have missed it!

Thanks Dave that's fine now.

Re: [steve_e] Putting javascript into a field

By nburkha1 - March 27, 2008 - edited: March 27, 2008

Hi Dave,

I was having the same issue and everytime I put in the javascript to hide the email the CMS just froze up and would not let me do it. Let me know how and if you are able to resolve this? I was using the WYSYWIG editor and tried uploading it using the html function. Thanks.

Nina

Re: [nburkha1] Putting javascript into a field

By steve_e - March 28, 2008

Hi Nina -
While you're waiting for Dave, I can tell you what I did.

I set up a section with a text box(call it 'email address' or something). As Dave mentions above, you I modified that field. Click on 'advanced options' at the bottom and check the box marked 'Disable auto-formatting (don't add break tags to content)'. This gets rid of the line breaks that otherwise break the javascript.

Then I set up my page by taking out the php viewer code for the page viewer and editing it into one of my web pages.

Where I want to put the javascripted email address I just pasted the field in like this:

<?php echo $record['email_address'] ?>

Didn't need to use any upload or html functions. When whoever is adding a record to that section needs to do so, they just copy the complete javascript and paste it into the text box. It works fine on my page.

Hope that helps.

Regards, Steve.

Re: [steve_e] Putting javascript into a field

By nburkha1 - March 28, 2008

Hi Steve,

Did you have to set up this field for each page that had an email address? Thanks.

Nina