Form with multiple instances of the image selector

  •  06-26-2007, 10:00 AM

    Form with multiple instances of the image selector

    Can you show me how I would include multiple instances of the image selector in a form

    here is my attempt in VB.net - I get this to work in IE but not Firefox passing a variable identifying the form elements directly


    <%@ Page Language="VB" Debug="true" validaterequest="false" %>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <%@ import Namespace="System.Data" %>
    <%@ import Namespace="System.Data.SqlClient" %>
    <%@ import Namespace="System.Xml" %>
    <%@ import Namespace="System.Xml.Xsl" %>
    <%@ import Namespace="System.Xml.XPath" %>
    <%@ import Namespace="System.Text" %>
    <%@ import Namespace="System.IO" %>
    <%@ import Namespace="System.Data.OleDb" %>

        <script runat="server">

        Sub Page_Init(Sender as Object, E as EventArgs)

            Editor1.Setting("security:ImageGalleryPath") = MapPath("/uploads/463/edit/")
            Editor1.Text = HttpUtility.HtmlDecode(elementtext)

        End Sub


        Sub Page_Load(Sender As Object, E As EventArgs)


        End Sub


    </script>
    <HTML>
    <HEAD>
    <title>ASP and ASP.NET WYSIWYG Editor - Use CuteEditor as an image selector</title>

    </HEAD>
    <body>
    <form runat="server" class="cssform">
    <h3>Add Images</h3>    
    <h5>Gallery: This Olde Gallery</h5>    

    <p>
    <asp:TextBox id="imageFld1" Width="300" runat="server" class="image" />
    <INPUT type="button" value="Image" onClick="callInsertImage('imageFld1')" id="Change1" runat="server" NAME="Change1"/>

    </p>
    <p>
    <asp:TextBox id="imageFld2" Width="300" runat="server" class="image" />
    <INPUT type="button" value="Image" onClick="callInsertImage('imageFld2')" id="Change2" runat="server" NAME="Change2"/>   

    </p>
    <div>
    <CE:Editor FilesPath="/orcaedit" id="Editor1" runat="server" Width="1" Height="1" AutoConfigure="None" ShowHtmlMode="False" ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False" ShowBottomBar="False" BackColor="White" BorderColor="White" UseRelativeLinks="False" RemoveServerNamesFromUrl="True"></CE:Editor><br>
    </div>
    </form>
     
    <Script Language="javascript">
        function callInsertImage(daimage)  
        {  
                var editor1 = document.getElementById('<%=Editor1.ClientID%>');
                editor1.FocusDocument();  
                var editdoc = editor1.GetDocument();  
                editor1.ExecCommand('new');
                editor1.ExecCommand('ImageGalleryByBrowsing');
                InputURL(daimage);
                document.getElementById(daimage).focus();
        }    
        
        function InputURL(daimage)
        {
            var editor1 = document.getElementById('<%=Editor1.ClientID%>');
            var editdoc = editor1.GetDocument();  
            var imgs = editdoc.getElementsByTagName("img");
            if(imgs.length>0)  
            {    document.getElementById(daimage).value = imgs[imgs.length-1].src;
            }  
            else
            {
                setTimeout(InputURL,500);
            }  
        }       
    </script>

        </body>
    </HTML>



    orcais.com
View Complete Thread