hrefs with javascript calls seem to interfere with Cute Editor

  •  04-13-2006, 11:38 AM

    hrefs with javascript calls seem to interfere with Cute Editor

    I've recently run into an unusual behavior with the cute editor.

    I created an .aspx in VS2005 that contained a fairly basic editor with a databind and one other link containing an arbitrary "BLOCKED SCRIPT[function-call]" style href. 

    If I
    A) 1: Enter data in the editor, 2: click the arbitrary link, and 3: submit the form -- the data in the editor is sent normally through the Request.Form object (the form post).
    However, if I
    B) 1: Click the arbitrary link, 2: enter data in the editor, and 3: submit the form -- the data in the editor is completely missing from the the Request.Form object (the form post). 

    I searched but did not find this mentioned in the forums.  Can anyone give me any advice on defeating this?  (Obviously, never using href="BLOCKED SCRIPT..." will prevent the problem, but we use other components which often create such hrefs, so just dodging the issue isn't really an option.)

    Thanks.

    Here is an aspx that should reproduce the error:
    The related aspx.cs (the codebehind) is empty -- all code is inline in the example below.
    This is VS2005, in the .Net 2.0 framework, but the problem seems to be a client-side JS scoping issue.

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="testCE2.aspx.cs" Inherits="testCE2" %>
    <%@ Register Assembly="CuteEditor" Namespace="CuteEditor" TagPrefix="CE" %>
    <%@ Register Assembly="CuteEditor.ImageEditor" Namespace="CuteEditor.ImageEditor" TagPrefix="iws" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Cute Editor vs. BLOCKED SCRIPT e.g. page</title>
    </head>
    <body>
        <%
            if (Page.IsPostBack)
            {
                Response.Write("<big>Postback detected.  Value found in form post is: " + Request.Form["editEventDetailsEdit"].ToString() + "<br /></big>");
                editEventDetailsEdit.Text = "";
            }
         %>
        <form id="form1" runat="server">
        <p>
        Here is the example.  To see normal operation, type some text in the editor and click the submit button.  If you click the "ruin everything" link, be sure to do so <i>after</i> using the editor.
        </p>
        <p>
        To see the bad behavior, <i>first</i> click the "ruin everything" link, then type some text in the editor and click the submit button.  The info will be lost from the form post.
        </p>
        <div>
        <a id="linkToRuin" href="BLOCKED SCRIPTalert('Okay, thanks to the BLOCKED SCRIPT... href, editor use hereafter is unlikely to show in the form post.');">ruin everything</a><br />
        <br />
           <CE:Editor ID="editEventDetailsEdit" runat="server" Height="100px" Text='<%# Bind("Details") %>'
            Width="95%" TemplateItemList="ToFullpage,FromFullPage,Bold,Italic,Underline,JustifyLeft,JustifyCenter,JustifyRight" >
            <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
            CssClass="CuteEditorFrame" Height="100%" Width="100%" />
            </CE:Editor>
            <br />
            <input type="submit" value="basic submit button" />
        </div>
        </form>
    </body>
    </html>

View Complete Thread