Javascript in Page or Post

May 1, 2011 at 6:50 AM
Edited Oct 24, 2011 at 8:15 PM

I put this code in Page:

<script type="text/javascript" src="http://app.icontact.com/icp/loadsignup.php/form.js?c=903725&amp;l=15993&amp;f=2936"></script>

then BlogEngine puts the "type="text/javascript" part at the end making it not work.

 

<script src="http://app.icontact.com/icp/loadsignup.php/form.js?c=903725&amp;l=15993&amp;f=2936" type="text/javascript"></script>

 

How do you make BlogEngine stop doing this?

 

Here the page: http://www.kbdavis07.bloggersonline.com/page/BlogEngine07.aspx

Its not a stand alone page.

 

Got the Google search to work : http://www.kbdavis07.bloggersonline.com/page/Search.aspx

with JavaScript no problem.

 

 

Put in Blogger No problem :  http://kbdavis007.blogspot.com/p/newsletter.html

 

Trying to use icontact.com   for their mailing list.

Java Blog

May 1, 2011 at 11:59 AM
Edited May 1, 2011 at 1:49 PM

That would be the tinyMCE editor stripping out tags and rehashing stuff for the greater good and advancement of the human race.

Open up the tinyMCE.ascx file in the BE admin folder and look for the line beginning extended_valid_elements:

Add this to the end

,script[language|type|src]

remember the preceeding comma.

Edit

Should really have given an exact example for the benefit of anybody else reading this:

Suppose this is how your existing line looks

extended_valid_elements: "object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode],iframe[src|width|height|name|align|frameborder]",

It becomes after editing

extended_valid_elements: "object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode],iframe[src|width|height|name|align|frameborder],script[language|type|src]",

And if you are experiencing similar problems with iFrames and the likes, this might well be the most likely culprit.

The tinyMCE forums are quite informative, but I wouldn't be in any rush to join, the punters take a thrashing.

May 1, 2011 at 11:53 PM

Tried editing the file like you said and it still does not work.  The problem is with the onclick

Its taking this out

onsubmit="return verifyRequired2936()   <--- This I think is the reason its not working.

 

Here is an HTML version:

 

Original Code:

 

<style>
.link,
.link a,
.signupframe
{
	color: #226699;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 13px;
	}
	.link,
	.link a {
		text-decoration: none;
		}
	.signupframe {
		border: 1px solid #000000;
		background: #ffffff;
		}
.signupframe .required {
	font-size: 10px;
	}
</style>
<form method=post action="https://app.icontact.com/icp/signup.php" name="icpsignup" id="icpsignup2936" accept-charset="UTF-8" 

onsubmit
="return verifyRequired2936();" >
<
input type=hidden name=redirect value="http://www.icontact.com/www/signup/thanks.html" /> <input type=hidden name=errorredirect value="http://www.icontact.com/www/signup/error.html" /> <div id="SignUp"> <table width="260" class="signupframe" border="0" cellspacing="0" cellpadding="5"> <tr> <td valign=top align=right> <span class="required">*</span> Email </td> <td align=left> <input type=text name="fields_email"> </td> </tr> <tr> <td valign=top align=right> First Name </td> <td align=left> <input type=text name="fields_fname"> </td> </tr> <input type=hidden name="listid" value="27915"> <input type=hidden name="specialid:27915" value="G2NV"> <input type=hidden name=clientid value="903725"> <input type=hidden name=formid value="2936"> <input type=hidden name=reallistid value="1"> <input type=hidden name=doubleopt value="0"> <tr> <td> </td> <td>View my <a href="http://community.icontact.com/p/5599930195973120028">publisher profile</a>.</td> </tr> <tr> <td> </td> <td><span class="required">*</span> = Required Field</td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </div> </form> <script type="text/javascript"> var icpForm2936 = document.getElementById('icpsignup2936'); if (document.location.protocol === "https:") icpForm2936.action = "https://app.icontact.com/icp/signup.php"; function verifyRequired2936() { if (icpForm2936["fields_email"].value == "") { icpForm2936["fields_email"].focus(); alert("The Email field is required."); return false; } return true; } </script> <span class="link"><a href="http://www.icontact.com">Email Marketing</a> You Can Trust</span>

Now this is the OutPut Code from BlogEngine Page:

<!-- .link, .link a, .signupframe { 	color: #226699; 	font-family: Arial, Helvetica, sans-serif; 	font-size: 13px; 	} 	.link, 	.link a { 		text-decoration: none; 		} 	.signupframe { 		border: 1px solid #000000; 		background: #ffffff; 		} .signupframe .required { 	font-size: 10px; 	} --> 

<form id="icpsignup2936" action="https://app.icontact.com/icp/signup.php" accept-charset="UTF-8" method="post"> <input name="redirect" type="hidden" value="http://www.icontact.com/www/signup/thanks.html" /> <input name="errorredirect" type="hidden" value="http://www.icontact.com/www/signup/error.html" />
<div id="SignUp">
<table class="signupframe" border="0" cellspacing="0" cellpadding="5" width="260">
<tbody>
<tr>
<td align="right" valign="top"><span class="required">*</span> Email</td>
<td align="left"><input name="fields_email" type="text" /></td>
</tr>
<tr>
<td align="right" valign="top">First Name</td>
<td align="left"><input name="fields_fname" type="text" /></td>
</tr>
<input name="listid" type="hidden" value="27915" /> <input name="specialid:27915" type="hidden" value="G2NV" /> <input name="clientid" type="hidden" value="903725" /> <input name="formid" type="hidden" value="2936" /> <input name="reallistid" type="hidden" value="1" /> <input name="doubleopt" type="hidden" value="0" /> 
<tr>
<td></td>
<td>View my <a href="http://community.icontact.com/p/5599930195973120028">publisher profile</a>.</td>
</tr>
<tr>
<td></td>
<td><span class="required">*</span> = Required Field</td>
</tr>
<tr>
<td></td>
<td><input name="Submit" type="submit" value="Submit" /></td>
</tr>
</tbody>
</table>
</div>
</form>
<script type="text/javascript">// <![CDATA[
var icpForm2936 = document.getElementById('icpsignup2936');

if (document.location.protocol === "https:")

	icpForm2936.action = "https://app.icontact.com/icp/signup.php";
function verifyRequired2936() {
  if (icpForm2936["fields_email"].value == "") {
    icpForm2936["fields_email"].focus();
    alert("The Email field is required.");
    return false;
  }


return true;
}
// ]]></script>
<p><span class="link"><a href="http://www.icontact.com">Email Marketing</a> You Can Trust</span></p></div>    

 

 

May 2, 2011 at 7:26 AM
Edited May 2, 2011 at 8:14 AM

Ah! you didn't mention that in your original post, but I did test the part with script[language|type|src]  added to extended_valid_elements, and it inserts the line you originally mentioned correctly.

 

<script type="text/javascript" src="http://app.icontact.com/icp/loadsignup.php/form.js?c=903725&amp;l=15993&amp;f=2936"></script> //This part works

 

 

You need to tell tinyMCE not to go stripping stuff from your form elements,  add this to extended_valid_elements

,form[name|id|action|method|enctype|accept-charset|onsubmit|onreset|target]

I've just tried pasting your HTML into the editor HTML view and with the above parameter added the onsubmit is not being stripped out, of course that does not mean everything else will work.

An alternative would be to bypass the editor and get the server to insert the code, but that's not ideal either.

Edit

I've just noticed that it's also commenting out your style tags, so you will need to add "style" to your list of extended_valid_elements

,form[name|id|action|method|enctype|accept-charset|onsubmit|onreset|target],style