PDA

View Full Version : Hiding Email on Newsletter Signup box


Chuckie
06-Dec-2007, 01:59 AM
Hi there people, i see a lot of people having signup to our newsletter on there websites now and i want to do the same, i have groupmail setup and working fine for the newsletter idea, even the form mail page working fine, but it only currently works if i put the email address in plain text which i dont want to do because of spambots and stuff.

I have used a bit of java script to hide break down the email address and then add the bits up into one variable, but what i dont seem to be able to get right is the bit of code to put in the form box.

<script language="JavaScript">
function readText (form) {
Var_a ="newsletter";
Var_b ="modelpower";
Var_c ="co";
Var_d ="uk";
Var_e = Var_a + "@" + Var_b + "." + Var_c + "." + Var_d
}
</script> <!-- start form code -->
<form action="http://www.modelpower.co.uk/cgi-sys/FormMail.cgi" method="post">
<input type="hidden" name="recipient" value="document.write (Var_e);">
<input type="hidden" value="Subscribe Me" name="subject">
<input type="hidden" value="http://www.modelpower.co.uk/" name="redirect">
<input type="text" name="email">
<input type="submit" value="Subscribe Me"></form> <!-- end form code -->

the result i get is from the form mail page
" Email addresses may not contain (,),>,< or other control chars. "

have browsed a lot of the threads on here but they talk about the script part but not about hpw to build it into form mail.

hope someone can solve my little problem.

Bruce
11-Dec-2007, 01:56 PM
Hi,

The following code will look the same to customers, but will protect your email address:
<script type=text/javascript>
var _u = "sales";
var _d = "domain.co.uk";
var _l = _u + "@" + _d;
var _m = "click to email us";
document.write("<a href='mailto:"+_l+"'>"+_m+"</a>");
</script>
Change the 'sales' and 'domain.co.uk' to your own email address.

Kind regards,

g11ary
11-Dec-2007, 11:37 PM
If this stops spam getting your address, can you please tell me where and how to enter it.

Duncan Rounding
12-Dec-2007, 05:31 AM
You can use it anywhere you waant you email address to appear on your sites. Just go to design view find the code and replace it with the above.

papermilldirect
12-Dec-2007, 01:17 PM
James,

We use Groupmail and Groupmetrics in conjuction.

It accepts signups, removals and using the schedular will automatically update your group list... it really is good.

1 credit per signup or remove. 5000 credits are abount £6

It's been a godsend.

Paul

Chuckie
12-Dec-2007, 09:01 PM
Hiya bruce i kinda get how the script part works but how do i get the form part to refer to script part, if you look in my original post i had kinda done it but how do i set the recipient address for where i want the mail to go to, thats the problem i was having, i currently have a php form working and doing the job in test at the moment but a simple html one would be good for me. Hope some one can help because i dont really want to use peoples email clients to start with to send the subscribe message.

thanks

Bruce
13-Dec-2007, 10:12 AM
<script type=text/javascript>
var _u = "newsletter";
var _d = "modelpower.co.uk";
var _l = _u + "@" + _d;
</script>

<!-- start form code -->
<form action="http://www.modelpower.co.uk/cgi-sys/FormMail.cgi" method="post">
<input type="hidden" name="recipient" value="document.write ("+_l+");">
<input type="hidden" value="Subscribe Me" name="subject">
<input type="hidden" value="http://www.modelpower.co.uk/" name="redirect">
<input type="text" name="email">
<input type="submit" value="Subscribe Me">
</form>
<!-- end form code -->

I am not sure if the above would work but that is how you should do it.

Kind regards,

Chuckie
13-Dec-2007, 12:53 PM
Hiya bruce, i have just tried that and the form displays ok, but when i click on the submit button to send the information to formail script it get this message come up "Email addresses may not contain (,),>,< or other control chars." So i guess this means that the email address isnt being written correctly to the by the script i guess.

Any ideas guys ?

Thanks

Bruce
17-Dec-2007, 03:30 PM
Hi James,

Apologies for the delay in getting back to you on this one. Can you mail me a link to the site so that I could test it too.

Kind regards,

Chuckie
18-Dec-2007, 12:15 AM
hiya bruce, no worries about the delay aslong as what i thought was a simple problem can be solved, the link for the script you want is here
http://www.modelpower.co.uk/testing/emailtest.html
that in itself links to formMail which is working because i tested it with out the hiding the email address bit.


I have copied everything out of the test file and pasted it here also
" Start "
<html>
<head>
<title></title>
</head>

<script type=text/javascript>
var _u = "newsletter";
var _d = "modelpower.co.uk";
var _l = _u + "@" + _d;
</script>


<body bgcolor="#FFFFFF">

<!-- start form code -->
<form action="http://www.modelpower.co.uk/cgi-sys/FormMail.cgi" method="post">
<input type="hidden" name="recipient" value="document.write ("_l");">
<input type="hidden" value="Subscribe Me" name="subject">
<input type="hidden" value="http://www.modelpower.co.uk/" name="redirect">
<input type="text" name="email">
<input type="submit" value="Subscribe Me">
</form>
<!-- end form code -->


</body>


</html>

" Finish "
there you go bruce every things there now

Bruce
19-Dec-2007, 11:28 AM
Hi,

The code needs to be just before the closing head tag ...

<title></title>

<script type=text/javascript>
var _u = "newsletter";
var _d = "modelpower.co.uk";
var _l = _u + "@" + _d;
</script>
</head>

Instead of how you have it at the moment.

Kind regards,

Chuckie
19-Dec-2007, 11:50 AM
hiya bruce, do you want bad news or the bad news
sadly that doesnt work :(
just tried it and i get the same error.
"Email addresses may not contain (,),>,< or other control chars."

heres the code as it stands

<html>
<head>
<title></title>
<script type=text/javascript>
var _u = "newsletter";
var _d = "modelpower.co.uk";
var _l = _u + "@" + _d;
</script>
</head>
<body bgcolor="#FFFFFF">
<!-- start form code -->
<form action="http://www.modelpower.co.uk/cgi-sys/FormMail.cgi" method="post">
<input type="hidden" name="recipient" value="document.write ("_l");">
<input type="hidden" value="Subscribe Me" name="subject">
<input type="hidden" value="http://www.modelpower.co.uk/" name="redirect">
<input type="text" name="email">
<input type="submit" value="Subscribe Me">
</form>
<!-- end form code -->
</body>
</html>

Duncan Rounding
19-Dec-2007, 02:36 PM
I don't think you need the quotes around _l
Have you tried:
value="document.write (_l);">

Chuckie
19-Dec-2007, 02:45 PM
hiya drounding, i would love to say you win the prize and go to the top of the class, i have tried your variations but to no avail :(
thanks for your help though

Duncan Rounding
19-Dec-2007, 03:01 PM
I think there may be more than one fault then.
This won't work for starters:
value="document.write ("_l");">
you will definitely need to remove the quotes around the _l
I just tested the script in a test page and the address is formed correctly but the document.write is wrong.

Perhaps therefore it's also related to the form input and the script running inside the form.

Chuckie
19-Dec-2007, 03:22 PM
Hiya, i got the top bit working also which is good, i think the problem might be in the input feild also but im not sure how to correct it sadly else everything would sorted, WooHoo in a heroe style voice.

Thanks for the testing,
Merry Christmas Everybody

Duncan Rounding
19-Dec-2007, 03:54 PM
Try using escapes and perhaps doc writing the whole fofm in chunks.

Chuckie
19-Dec-2007, 04:05 PM
not sure on how to do that, on this sort of problem google never gives me the direct answer i require, :( hopefully i will get it sorted soon will be better this was than having a link to another form. and then clicking another button.

Chuckie
20-Dec-2007, 12:09 AM
hi there i have tested different methods evening by removing the quotation marks too, the script doesnt throw up any errors because it just passes document.write through as the reciptient address.
i have altered the script to not use the formail at the moment but to pass the results to a message box.

hmm challenging this one, i dont think the value box likes me writing to it like the way i want :(

Duncan Rounding
20-Dec-2007, 04:38 AM
By writing directly to the form value it appears to work. Add a form id and then reference that in the js for the write to the recipient as below:.


<html>
<head>
<title></title>

<script type=text/javascript>
var _u = "newsletter";
var _d = "modelpower.co.uk";
var _l = _u + "@" + _d;
</script>

</head>

<body>

<!-- start form code -->
<form id="email" action="http://www.modelpower.co.uk/cgi-sys/FormMail.cgi" method="post">
<input type="hidden" name="recipient" value="";>

<script language="JavaScript">
document.forms.email.recipient.value= _l;
</script>

<input type="hidden" value="Subscribe Me" name="subject">
<input type="hidden" value="http://www.modelpower.co.uk/" name="redirect">
<input type="text" name="email">
<input type="submit" value="Subscribe Me">
</form>
<!-- end form code -->

</body>
</html>

Chuckie
20-Dec-2007, 09:37 AM
Good Morning Duncan, go to the top of the class, i see you have got it working, but does that mean i now have to find a way to protect the formail script to stop spammers using it to send junk mail. Because i see there was a 4 emails in there already from your tests. Or were you using another formail script and my email address ?

Congratulations and got to the top of the class, you have won the competition :)

Thanks again

Duncan Rounding
20-Dec-2007, 09:43 AM
Those were from me. ;)

Chuckie
20-Dec-2007, 09:50 AM
Hiya duncan i guessed that, but i mean did you use my mail script or your own to test the test form with ? Because if you used my formMail script on your server then that makes me think that mine isnt very well protected, where as if you used yours then thats fine.

Got me wondering now.

Duncan Rounding
20-Dec-2007, 09:55 AM
I copied your code from your test page, modified it and ran it locally in my browser here - just as it would be done normally.
You pose an interesting question though - I did use your formail on your server - as per the code above.

Chuckie
20-Dec-2007, 10:17 AM
I have emailed our host regarding this problem, and hopefully they can provide a solution to that problem.
Thanks for your help duncan, and everyone, i only hope i can help you out sometime aswell

Cheers
Wishing you all a merry christmas and a happy new year

Chuckie
23-Dec-2007, 12:15 AM
hiya, everything is working ok now, on brochure pages and product pages, the only page i seem to have a problem with the code is on the products link off the brochure page, i guess all these pages use the same code and its on http://www.modelpower.co.uk/acatalog/shop.html that gives me a problem, all other pages that i have tried seem fine and they all have the same code so why would this page be different and give me a
"A General Script Error Occurred

--------------------------------------------------------------------------------
Error: There is no valid input parameters for the script! Check the referencing HTML code!
--------------------------------------------------------------------------------
Press the Browser back button and try again or contact the site owner "
and its got this page in the address bar
http://www.modelpower.co.uk/cgi-bin/ca012498.pl when it shouldnt, it should send the form like every other page and then return to the home page.
Has anyone got any ideas thanks

Duncan Rounding
23-Dec-2007, 07:37 AM
The code is quite different on each page. Check that you have the same layout selected for both and that the same code is used for both.

Chuckie
23-Dec-2007, 03:35 PM
i have redone both act_primary.html & act_brouchureprimary.html, both using the same email form code, with the building of the email address up in the <head> part of the page, and the form building part where it should be. The code works on the front page, and subsection pages of the website. The only page it doesnt work on is the /acatalog/shop.html page. I have checked the setting in actinic and as far as i can tell it only uses those 2 files to build them pages for primary use. All the other times the emails are sent correctly and it returns to the home page as the script should, but only on the main shop window with the list of main products does it try to send the information to a cgi script. Would this problem be caused by the submit button sending information the wrong way ?

I have used the same code and copied it into the same places in these two files. All the form and /form tags are in place before and after the submit button and any other form parts.

any ideas, thanks again all