Jump to content

image button doesn't submit form, but hitting enter does


toolman

Recommended Posts

Hi,

 

I have the following code for a newsletter signup. The form works when the user enters their email address and hits enter, but if the submit the form using the image or a link, it prompts them with a message saying the email address is invalid.

 

Any ideas what would cause this?

 

Thanks

 

 
(function(a){var b={g:function(){var d=document.cookie.split(";");for(var e=0;e<d.length;e++){var f=d[e];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf("euCookieLaw")==0){return f.substring("euCookieLaw".length,f.length)}}return null},s:function(d){var c=new Date();c.setTime(c.getTime()+315532800000);document.cookie="euCookieLaw="+d+"; expires="+c.toGMTString()+"; path=/"}};a.extend({cookieLaw:function(c){var e={impliedConsent:true,title:"Our Cookie Policy",shortMessage:"<h3>Sign up for Special Offers</h3><p><img src=\"/beta/images/small_tick.png\" /> Discount Codes and Promotions<br /><img src=\"/beta/images/small_tick.png\" /> Receive Special Offers<br /><img src=\"/beta/images/small_tick.png\" /> Latest News and Competitions</p><p><strong>Enter your email to signup:</strong></p><form action=\"action.php" method=\"post\" id=\"newsletter_form\"><input type=\"text\" id=\"email\" onfocus=\"javascript:this.value =(this.value == 'Your email address...')?'':this.value;\" onblur=\"javascript: this.value=(!this.value)?'Your email':this.value;\" class=\"email\" maxlength=\"4000\" name=\"EMAIL\" value=\"Your email\" size=\"23\" /><a href=\"#\" onclick=\"var form = document.getElementById('newsletter_form'); Marketing.OptIn(form); return false\" title=\"Sign Up for offers\" class=\"button\">signup</a><input type=\"hidden\" name=\"EMAIL_REQUIRED\" value=\"T\" /><input type=\"hidden\" name=\"EMAIL_DATATYPE\" value=\"email\" /><input type=\"hidden\" name=\"agent_code_REQUIRED\" value=\"T\" /><input type=\"hidden\" name=\"agent_code_DATATYPE\" value=\"text\" /><input type=\"hidden\" id=\"newsletter_agentCode\" name=\"agent_code\" value=\"$ref_code\" /></form>",longMessage:"Cookies are small text files held on your computer. They allow us to give you the best browsing experience possible and mean we can understand how you use our site.",onAccepted:function(){}},d=b.g();c=a.extend(e,c);if(d==null){a.notify({inline:true,html:"<h3>"+c.title+"</h3><p>"+c.shortMessage+'</p><p id="euCookieLongMessage" style="display: none;">'+c.longMessage+'</p><p id="euCookieButtonContainer">'+(!c.impliedConsent?'<a id="euCookieAccept" class="btn primary" href="#">I Accept</a>':"")+' <a class="btn" id="euCookieMoreInfo" href="#">More Info</a> </p>',close:(!c.impliedConsent?a("#euCookieAccept"):"Close"),onComplete:function(){a("#euCookieMoreInfo").click(function(){if(a("#euCookieLongMessage").is(":hidden")){a(this).text("Less Info");a("#euCookieLongMessage").fadeIn(250);a.notify("resize",a(this).parents(".notification"))}else{a(this).text("More Info");a("#euCookieLongMessage").fadeOut(250,function(){a.notify("resize",a(this).parents(".notification"))})}});if(c.impliedConsent){b.s("implied");c.onAccepted.call(this)}},onCleanup:function(){b.s("accepted");c.onAccepted.call(this)}})}else{c.onAccepted.call(this)}}})})(jQuery);

It's difficult to tell what's going on since code doesn't have any line breaks. One issue that I noticed, however, is that the following has an unescaped double quote:

 

 

<form action=\"action.php" method=\"post\"

 

I'm not sure if that would cause the problem you describe though...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.