Word editor Object not working

I have an Object from Microsoft.  It is a text manipulator. It makes the text bold, italic etc.  I had been working with it on another site, and decided to upgrade a new sites admin tools with it.  However, I believe to have the page all "Tweaked" on the new site, yet it is not working.  The Text area is populating from the database (as queried through a combo box), however the command (bold, italic etc) buttons are not affecting the text in the text area.  I believe to have the right code on the asp page, and think that I am not rferencing the object correctly, yet it works on the first site!  Are there issues that I am not aware of?  Here is the Referecing Code;

<TABLE width=100% align=center>
      <TR>
            <TD>
<!-- DHTML Editing control Object. This will be the body object for the toolbars. -->
<object ID="tbContentElement" style="width:600" CLASSID="clsid:2D360200-FFF5-11d1-8D03-00A0C959BC0A" VIEWASTEXT>
      <param name=Scrollbars value=true>
</object>

<!-- DEInsertTableParam Object -->
<object ID="ObjTableInfo" CLASSID="clsid:47B0DFC7-B7A3-11D1-ADC5-006008A5848C" VIEWASTEXT>
</object>

<!-- DEGetBlockFmtNamesParam Object -->
<object ID="ObjBlockFormatInfo" CLASSID="clsid:8D91090E-B955-11D1-ADC5-006008A5848C" VIEWASTEXT>
</object>
            </TD>
      </TR>
      <TR>
            <TD align=center>
                  <INPUT type="submit" value="Update Page Description" id=button name=button onClick="submitForm()">
            </TD>
      </TR>
</TABLE>

Any Ideas ?(by the way, both sites are on the same server and in the same directory)
LVL 1
khagenAsked:
Who is Participating?
 
scotiaceilidhCommented:
Sorry khagen,
You're out of luck.  There is not such tool other than the one you mentioned.  You could make an Active X control or just the basic one you have now.  Sorry.
0
 
jamestthomasCommented:
you do not have a codebase tag that points to the locations of the controls.
I think that is needed although I stand corrected if it is different using DHTML
Editing Control Objects.  I am just pointing out what I noticed missing!
0
 
AemerginCommented:
I'm not sure what the problem is .. I run the script locally here and when the textarea comes up, I can use CTRL-B for bold, CTRL-I for italic .. is it not doing this for you? Is there supposed to be more? All I see is a textarea box and below it is a button to submit ..

-Aemergin
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
khagenAuthor Commented:
Yes, the CTRL-B is working, I forgot to give the code for the tool bar that is above the previous code;

<TABLE width=100% align=center>
      <TR>
            <TD align=left>
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Bold.gif')" id="DECMD_BOLD" name="DECMD_BOLD">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Italic.gif')" id="DECMD_ITALIC" name="DECMD_ITALIC">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Under.gif')" id="DECMD_UNDERLINE" name="DECMD_UNDERLINE">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Bullist.gif')" id="DECMD_UNORDERLIST" name="DECMD_UNORDERLIST">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Link.gif')" id="DECMD_HYPERLINK" name="DECMD_HYPERLINK">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Image.gif')" id="DECMD_IMAGE" name="DECMD_IMAGE">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Fgcolor.gif')" id="DECMD_SETFORECOLOR" name="DECMD_SETFORECOLOR">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Left.gif')" id="DECMD_JUSTIFYLEFT" name="DECMD_JUSTIFYLEFT">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Center.gif')" id="DECMD_JUSTIFYCENTER" name="DECMD_JUSTIFYCENTER">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Right.gif')" id="DECMD_JUSTIFYRIGHT" name="DECMD_JUSTIFYRIGHT">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Undo.gif')" id="DECMD_UNDO" name="DECMD_UNDO">
                  &nbsp;&nbsp;&nbsp;&nbsp;<FONT face=Verdana,arial,tahoma size=2 color=#000000>Edit page description below</FONT>&nbsp;&nbsp;
            </TD>
      </TR>
</TABLE>


This tool bar is used in conjuction with a series of subs.  The sub for the bold button is this;

sub DECMD_BOLD_onclick()
  tbContentElement.ExecCommand DECMD_BOLD,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub


By the way, the other site has no Codebase with it and works fine.
0
 
khagenAuthor Commented:
Adjusted points to 75
0
 
AemerginCommented:
Are you using the new and improved version for MSIE 5, or the original that runs on MSIE 4+? From what I understand (after reading through the MS site), the MSIE 5 version will only work in an MSIE 5 browser, and it must be the most current load of the browser (some betas did not work with this control).

You might want to redownload and reinstall the component from MS. I don't know that this will help, but if you're using the clsid for the old version, and writing subs for the new version, things aren't going to work out right.

On another note .. could you post your complete code, with the subs? I'm interested in exactly how it works, sounds like I've missed out on a real gem. ;)

-Aemergin
0
 
khagenAuthor Commented:
Here is the full Code,
I am using this successflly on another site, so the references are the same, as well I'm usin the same browser, and the sites are on the same server, all is the same.  Just one does not work.  The code is for the working page.  It is handy (although not in netscape)


<%@ Language=VBScript %>
<%
      if Session("loggedin")<>true then
            Response.redirect("default.asp")
      end if
%>
<HEAD>
<%
Response.Buffer()%>

<%const CONNECTIONSTRING="DSN=NPUPS97;uid=; pwd=;"%>
<%
Dim pageText,conn,rs,tmpStory,i,tmp,strGroups,rs2,strPicture, strTitle, strDate, strAuthor, strNewsID
set conn = CreateObject("ADODB.Connection")
set rs = server.createobject("adodb.recordset")
set rs2 = server.createobject("adodb.recordset")

conn.open CONNECTIONSTRING

response.write(request("Submit"))
if request.querystring("UPDATE") = "TEXT" then
      if Request.QueryString("ID")="" or Request.QueryString("ID")="0" then
            conn.execute ("Insert Into News ( Title, NDate, Author, Story ) Values ( '" & request("Title") & "', '" & request("Date") & "', '" & request("Author") & "', '" & request("Story") & "')")
            'Response.Write("inserted")
      elseif request.querystring("ID")<>"0" then
            conn.execute ("UPDATE News SET Story = '" & request("story") & "', Title = '" & request("Title") & "', NDate = '" & request("Date") & "', Author = '" & request("Author") & "'  WHERE NewsID = " & request.querystring("ID") & ";")
            'Response.Write("updated")
      end if
end if

if request.querystring("Delete") <> Empty then
      conn.execute ("Delete From News WHERE NewsID = " & request.querystring("Delete") & ";")
end if

' vb is not a real language if I do this:
' if false and (2nd statement) then
' it still runs 2nd statement, real languages know not to run
' 2nd statement so I have to do an akward statement:
if Request.querystring("ID")<>"" then
      if cint(request.querystring("ID")) > 0 then
      rs = conn.execute("SELECT * from News WHERE NewsID = " & request.querystring("ID"))
      tmp = rs("Story")
      strNewsID = rs("NewsID")
      strTitle = rs("Title")
      strDate = rs("NDate")
      strAuthor = rs("Author")
      i=1
      tmpStory = ""
      while (i < len(tmp))
            if (CStr(mid(tmp,i,1)) <> CStr(chr(13))) and (CStr(mid(tmp,i,1)) <> CStr(chr(10))) and (CStr(mid(tmp,i,1)) <> CStr(chr(34))) and (CStr(mid(tmp,i,1)) <> CStr(chr(39))) then
                  tmpStory = tmpStory & CStr(mid(tmp,i,1))
            end if
            i=i+1
      wend
      end if
end if

rs2.open "SELECT NewsID, title from News ORDER BY NDate",conn
strGroups = "<OPTION SELECTED value='0'>-- Add New --</OPTION>"
while not rs2.eof
      ' same lame deal as before, vb as a language is designed by focus groups
      ' not programmers.
      if Request.QueryString("ID")<>"" then
            if CInt(request("ID")) = CInt(rs2("NewsID")) then
                  strGroups = strGroups & "<OPTION SELECTED value='" & rs2("NewsID") & "'>" & rs2("title") & "</OPTION>"
            else
                  strGroups = strGroups & "<OPTION value='" & rs2("NewsID") & "'>" & rs2("title") & "</OPTION>"
            end if
      else
            strGroups = strGroups & "<OPTION value='" & rs2("NewsID") & "'>" & rs2("title") & "</OPTION>"
      end if
      rs2.movenext
wend
rs2.close
%>
<script language="VBScript">
<!--
//globals
<!--#include file="./dhtmled.js"-->
sub pages_onChange()
   if document.forms(0).pages.value <> "" then
      window.location.href="EditNews.asp?ID=" & document.forms(0).pages.value
   end if
end sub
sub DECMD_BOLD_onclick()
  tbContentElement.ExecCommand DECMD_BOLD,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_UNDERLINE_onclick()
  tbContentElement.ExecCommand DECMD_UNDERLINE,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_ITALIC_onclick()
  tbContentElement.ExecCommand DECMD_ITALIC,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_HYPERLINK_onclick()
  tbContentElement.ExecCommand DECMD_HYPERLINK,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_SETFORECOLOR_onclick()
  dim arr
  arr = showModalDialog( "./selcolor.htm","","font-family:Verdana; font-size:12; dialogWidth:30em; dialogHeight:30em" )
  'if (arr <> null) then
    tbContentElement.ExecCommand DECMD_SETFORECOLOR,OLECMDEXECOPT_DODEFAULT, arr
  'end if
end sub
sub DECMD_UNORDERLIST_onclick()
  tbContentElement.ExecCommand DECMD_UNORDERLIST,OLECMDEXECOPT_DODEFAULT
  tbContentElement.focus()
end sub
sub DECMD_UNDO_onclick()
  tbContentElement.ExecCommand DECMD_UNDO,OLECMDEXECOPT_DODEFAULT
  self.focus()
  tbContentElement.focus()
end sub
sub submitForm()
      dim i,tmp
      tmp = tbContentElement.DocumentHTML
      i=1
      tmpStory = ""
      while (i < len(CStr(tmp)))
            if (CStr(mid(tmp,i,1)) <> CStr(chr(13))) and (CStr(mid(tmp,i,1)) <> CStr(chr(10))) and (CStr(mid(tmp,i,1)) <> CStr(chr(34))) and (CStr(mid(tmp,i,1)) <> CStr(chr(39))) then
                  tmpStory = tmpStory & CStr(mid(tmp,i,1))
            end if
            i=i+1
      wend
    document.forms(0).action="EditNews.asp?UPDATE=TEXT&ID=" & document.forms(0).pages.value
      document.forms(0).Story.value=tmpStory
      document.forms(0).submit()
end sub
sub window_onLoad()
      tbContentElement.DocumentHTML="<%=tmpStory%>"
end sub
sub DECMD_JUSTIFYCENTER_onclick()
  tbContentElement.ExecCommand DECMD_JUSTIFYCENTER,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_JUSTIFYLEFT_onclick()
  tbContentElement.ExecCommand DECMD_JUSTIFYLEFT,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_JUSTIFYRIGHT_onclick()
  tbContentElement.ExecCommand DECMD_JUSTIFYRIGHT,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
sub DECMD_IMAGE_onclick()
  tbContentElement.ExecCommand DECMD_IMAGE,OLECMDEXECOPT_DODEFAULT
  self.focus
  tbContentElement.focus
end sub
-->
</script>
</HEAD>
<BODY bgcolor="#CC9966">
<center>
<p><img src="../images/top_hdrlogo.gif" height="14"><br>
                <img src="../images/middle_hdrlogo.gif" height="13"><br>
                <img src="../images/bottom_hdrlogo.gif" height="16"><br>
                <img src="../images/bottom_logo_nav.gif" height="14"></p>
</center>
<FORM name=Form1 id=Form1 Method=Post Action="EditNews.asp">
<TABLE WIDTH=600 BORDER=0 CELLSPACING=0 CELLPADDING=0 align=center>
      <TR>
            <TD align=middle border=0>
            <FONT face=Verdana,arial,tahoma size=2 color=#000000><B>News & Information Administration</B></FONT>
           
            </TD>
      </TR>
      <TR>
            <TD align=middle background=../images/headers/fill.gif>
            </TD>
      </TR>
      <TR>
            <TD align=left valign=top>
            <BR><BR>
                  <TABLE border=0 width=100%>
                        <TR>
                              <TD align=right valign=top width=55% height=60>
                              <FONT face=Verdana,arial,tahoma size=2 color=#000000>Choose the title of the News Story you wish to edit:</FONT>&nbsp;&nbsp;
                              </TD>
                              <TD align=left valign=top>
                                    <SELECT id=pages name=pages style="WIDTH: 100%">
                                    <%=strGroups%>
                                    </SELECT>                        
                              </TD>
                        </TR>
                        <TR>
                              <TD align=right valign=top width=55% height=60>
                              <FONT face=Verdana,arial,tahoma size=2 color=#000000>Enter or modify the News Story Title:</FONT>&nbsp;&nbsp;
                              </TD>
                              <TD align=left valign=top>
                                    <INPUT name="Title" value="<%=strTitle%>">
                              </TD>
                        </TR>
                        <TR>
                              <TD align=right valign=top width=55% height=60>
                                    <FONT face=Verdana,arial,tahoma size=2 color=#000000>Enter or modify the news date:</FONT>&nbsp;&nbsp;
                              </TD>
                              <TD align=left valign=top>
                                    <INPUT name="Date" value="<%=strDate%>">
                              </TD>
                        </TR>
                        <TR>
                              <TD align=right valign=top width=55% height=60>
                                    <FONT face=Verdana,arial,tahoma size=2 color=#000000>Enter or modify the author's name:</FONT>&nbsp;&nbsp;
                              </TD>
                              <TD align=left valign=top>
                                    <INPUT name="Author" value="<%=strAuthor%>">
                              </TD>
                        </TR>
                        <TR>
                              <TD colspan=2 align=center valign=top width=55% height=60>
                                    <FONT face=Verdana,arial,tahoma size=2 color=#000000><A href="EditNews.asp?Delete=<%=strNewsID%>">Delete</A></FONT>
                              </TD>
                        </TR>
                  </TABLE>
                  <TABLE>
            </TD>
      </TR>
      <TR>
            <TD>
            <BR>
                  <INPUT type=hidden name="Story" id="Story" value="<%=tmpStory%>">
</Table>                  
</FORM>
<TABLE width=100% align=center>
      <TR>
            <TD align=left>
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Bold.gif')" id="DECMD_BOLD" name="DECMD_BOLD">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Italic.gif')" id="DECMD_ITALIC" name="DECMD_ITALIC">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Under.gif')" id="DECMD_UNDERLINE" name="DECMD_UNDERLINE">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Bullist.gif')" id="DECMD_UNORDERLIST" name="DECMD_UNORDERLIST">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Link.gif')" id="DECMD_HYPERLINK" name="DECMD_HYPERLINK">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Image.gif')" id="DECMD_IMAGE" name="DECMD_IMAGE">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Fgcolor.gif')" id="DECMD_SETFORECOLOR" name="DECMD_SETFORECOLOR">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Left.gif')" id="DECMD_JUSTIFYLEFT" name="DECMD_JUSTIFYLEFT">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Center.gif')" id="DECMD_JUSTIFYCENTER" name="DECMD_JUSTIFYCENTER">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Right.gif')" id="DECMD_JUSTIFYRIGHT" name="DECMD_JUSTIFYRIGHT">
                  <input type="button" style="width:30;BACKGROUND-IMAGE: url('IMAGES\Undo.gif')" id="DECMD_UNDO" name="DECMD_UNDO">
                  &nbsp;&nbsp;&nbsp;&nbsp;<FONT face=Verdana,arial,tahoma size=2 color=#000000>Edit page description below</FONT>&nbsp;&nbsp;
            </TD>
      </TR>
</TABLE>
<TABLE width=100% align=center>
      <TR>
            <TD>
<!-- DHTML Editing control Object. This will be the body object for the toolbars. -->
<object ID="tbContentElement" style="width:600" CLASSID="clsid:2D360200-FFF5-11d1-8D03-00A0C959BC0A" VIEWASTEXT>
      <param name=Scrollbars value=true>
</object>

<!-- DEInsertTableParam Object -->
<object ID="ObjTableInfo" CLASSID="clsid:47B0DFC7-B7A3-11D1-ADC5-006008A5848C" VIEWASTEXT>
</object>

<!-- DEGetBlockFmtNamesParam Object -->
<object ID="ObjBlockFormatInfo" CLASSID="clsid:8D91090E-B955-11D1-ADC5-006008A5848C" VIEWASTEXT>
</object>
            </TD>
      </TR>
      <TR>
            <TD align=center>
                  <INPUT type="submit" value="Update Page Description" id=button name=button onClick="submitForm()">
            </TD>
      </TR>
</TABLE>
</Table>

<!--#include file="adminnav.inc" -->

</BODY>
<%
conn.close
set rs=nothing
set conn=nothing
%>
0
 
AemerginCommented:
Wow .. that's a lot of code. ;)

Thanks, I'll mess with it and see what I can come up with, if nobody posts an answer by the time I figure it out, I'll let you know.

-Aemergin
0
 
khagenAuthor Commented:
Is There another object or piece of code anyone knows about that could do the same job?  The control would have to bold, hyperlink, colour, italic etc, a piece of text that was inserted in a text area.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.