Form with multiple instances of the image selector

Last post 06-27-2007, 10:44 AM by sperndogger. 4 replies.
Sort Posts: Previous Next
  •  06-26-2007, 10:00 AM 31084

    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
  •  06-26-2007, 10:01 PM 31107 in reply to 31084

    Re: Form with multiple instances of the image selector

    Functions should be changed to:
    <Script Language="javascript">
        function callInsertImage(Editor_ClientID, daimage)  
        {  
                var editor1 = document.getElementById(Editor_ClientID);
                editor1.FocusDocument();  
                var editdoc = editor1.GetDocument();  
                editor1.ExecCommand('new');
                editor1.ExecCommand('ImageGalleryByBrowsing');
                InputURL(daimage);
                document.getElementById(daimage).focus();
        }    
        
        function InputURL(Editor_ClientID, daimage)
        {
            var editor1 = document.getElementById(Editor_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>

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-27-2007, 9:36 AM 31127 in reply to 31107

    Re: Form with multiple instances of the image selector

    Sorry, I dont understand how you would then call the function
     
    <asp:TextBox id="imageFld1" Width="300" runat="server"  />
    <INPUT type="button" value="Image" onClick="callInsertImage(??????,'imageFld1')" id="Change1" runat="server" NAME="Change1"/>

    orcais.com
  •  06-27-2007, 10:09 AM 31132 in reply to 31127

    Re: Form with multiple instances of the image selector

    Change:
     
     
    <INPUT type="button" value="Image" onClick="callInsertImage(??????,'imageFld1')" id="Change1" runat="server" NAME="Change1"/>
     
    to:
     
    <INPUT type="button" value="Image" onClick="callInsertImage('CE_Editor1_ID','imageFld1')" id="Change1" runat="server" NAME="Change1"/>
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  06-27-2007, 10:44 AM 31139 in reply to 31132

    Re: Form with multiple instances of the image selector

    With that I get the Editor poping up and in Firefox it looks like I am populating the editor space that you assign width="1" to in your sample
     
    Can you view source here and identify why I would not be populating the text box with the image path?
     
    http://www.orcacms.com/ImagesTest.aspx
     
    Ernie

    orcais.com
View as RSS news feed in XML