editor features?

M

monika

I want to use a simple editor which has the capability of changing color or
bold it... a very simple one in my application of asp/access. Can anyone
suggest any such editor whereby I can use it?
my purpose is to get story written by a student in the textbox/textarea of
that editor from the database. The teacher highlights using the editor
features....making letters bold or in red to highlight changes. and then
save it to the database.

later available for the student to view his changes.

any help would be appreciable.
thanks
 
P

Phill. W

monika said:
I want to use a simple editor which has the capability of changing color
or bold it... a very simple one in my application of asp/access. Can
anyone suggest any such editor whereby I can use it?

Have you tried the RichTextBox control ?
Loading/Saving the TextRTF property from/to the database should
do the trick...

HTH,
Phill W.
 
T

Tom B

Try cutting and pasting the following....it'll get you started....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD>

<SCRIPT language=javascript id=clientEventHandlersJS>
<!--

var cursorPos;

function saveCursorPos(){
cursorPos=document.selection.createRange().duplicate();
//alert('cursorPos='+ cursorPos.value );

}

function cmdBullet_onclick()
{

divDisplay.document.execCommand('insertunorderedlist','','');
divDisplay.focus();
return false;



}

function cmdSave_onclick() {

//hiddenInput.value=divDisplay.innerHTML;
theForm.hiddenInput.value=divDisplay.innerHTML;
//theForm.hiddenProcInput.value=divProc.innerHTML;

if (theForm.hiddenInput.value.length >102399)
{
alert('Document is too big:' + theForm.hiddenInput.value.length);
return false;

}
if (theForm.Category.selectedIndex==0)
{
alert('Please select/create a Category');
return false;
}
if (theForm.Code.value.length==0)
{
alert('Please enter a Policy Number');
return false;
}
if (theForm.Title.value.length==0)
{
alert('Please enter a Policy Title');
return false;

}
if (theForm.hiddenInput.value.length==0)
{
alert('Please enter the Policy Content.');
return false;
}

theForm.submit();


}

function cmdNumbered_onclick() {
divDisplay.document.execCommand('insertorderedlist','','');
divDisplay.focus();
return false;
}

function cmdBold_onclick() {

divDisplay.document.execCommand('bold','','');
divDisplay.focus();
return false;

}

function cmdItalic_onclick() {
divDisplay.document.execCommand('italic','','');
divDisplay.focus();
return false;
}

function cmdTab_onclick() {
divDisplay.document.execCommand('indent','','');
divDisplay.focus();
return false;
}

function cmdUnTab_onclick() {
divDisplay.document.execCommand('outdent','','');
divDisplay.focus();
return false;
}



//-->
</SCRIPT>

</HEAD>
<BODY>


<DIV id=Layer1
style="Z-INDEX: 3; LEFT: 631px; WIDTH: 96px; POSITION: absolute; TOP:
9px; HEIGHT: 42px">
<DIV align=right><A href="http://tbserver/CCAC_V_1_0/"><IMG
src="Editor_files/close_spacer.gif" border=0></A></DIV></DIV>
<DIV id=overDiv
style="Z-INDEX: 1; LEFT: 300px; POSITION: absolute; TOP: 200px"></DIV>
<SCRIPT language=JavaScript src="Editor_files/overlib.js"></SCRIPT>

<H2 align=center><IMG height=50
src="Editor_files/add_new_policy_header2.gif" width=600></H2>
<FORM name=theForm action=SaveNew.asp method=post>

<TABLE width=500>
<TBODY>
<TR>
<TD>
<FIELDSET><LEGEND><FONT size=2>Policy Content </FONT></LEGEND>
<TABLE>
<TBODY>
<TR>
<TH colSpan=3>
<DIV align=center>
<TABLE cellSpacing=0 cellPadding=0 align=center>
<TBODY>
<TR>
<TD id=Bold width=31><INPUT language=javascript
id=cmdBold onclick="return cmdBold_onclick()"
type=image
src="Editor_files/Bold.gif" value=Bold name=image>
</TD>
<TD id=Italic width=31><INPUT language=javascript
id=cmdItalic onclick="return cmdItalic_onclick()"
type=image src="Editor_files/Italic.gif"
value=Italic
name=image> </TD>
<TD id=Bullet width=31><INPUT language=javascript
id=cmdBullet onclick="return cmdBullet_onclick()"
type=image src="Editor_files/Bullet.gif"
value=Bullet
name=cmdBullet> </TD>
<TD id=Numbered width=31><INPUT language=javascript
id=cmdNumbered onclick="return
cmdNumbered_onclick()"
type=image src="Editor_files/Numbered.gif"
value=Numbered name=image> </TD>
<TD id=Tab width=31><INPUT language=javascript
id=cmdTab
onclick="return cmdTab_onclick()" type=image
src="Editor_files/tab.gif" value=Tab name=image>
</TD>
<TD id=UnTab width=31><INPUT language=javascript
id=cmdUnTab onclick="return cmdUnTab_onclick()"
type=image src="Editor_files/Untab.gif" value=UnTab
name=image> </TD>
<TD id=UnTab width=311>
<DIV align=right><IMG height=30
src="Editor_files/add_policy_content.gif"

width=200></DIV></TD></TR></TBODY></TABLE></DIV></TH></TR>
<TR>
<TD colSpan=3><INPUT style="WIDTH: 207px; HEIGHT: 22px"
type=hidden size=26 name=hiddenInput>
<TABLE onclick=divDisplay.focus(); borderColor=#9ea1d6
height=100 cellSpacing=0 cellPadding=0 width=502
align=center
bgColor=#e5e6f3 border=1>
<TBODY>
<TR border="0">
<TD vAlign=top width=500 border="0">
<DIV id=divDisplay onkeyup=saveCursorPos();
contentEditable=true

name="divDisplay"></DIV></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD align=right colSpan=3><INPUT onclick=cmdSave_onclick();
type=button

value="Next>>>"></TD></TR></TBODY></TABLE></FIELDSET>
</TD></TR></TBODY></TABLE></FORM>
</BODY></HTML>
 
M

monika

hi tom ..thanks for the quick response. I realise that here divDisplay is
the object where i need to retrieve the value from the database. pls see the
change i did to make it useful for my application:
..
..
..
..
<%
DIM RSA
DIM QUERY

Set RSA = Server.CreateObject("ADODB.Recordset")
QUERY = "select story_name from story_table where story_id = 1"
rsa.open query, "dsn=school"
%>
<TR>
<TD colSpan=3><INPUT style="WIDTH: 207px; HEIGHT: 22px"
type=hidden size=26 name=hiddenInput>
<TABLE onclick=divDisplay.focus(); borderColor=#9ea1d6
height=100 cellSpacing=0 cellPadding=0 width=502
align=center bgColor=#e5e6f3 border=1
value=<%=rsa.fields("story_name")%>>
...remaining code...

but i dont the value being retrieved from the database? how can that be
achieved?
my purpose is to get the story from the database in the editable textbox or
whatever and then save the content to the database after changing it?

would be a great help if u respond.
thanks
 
T

Tom B

Don't use value= as that's for an input box and this is a div within a table
cell

<DIV id=divDisplay onkeyup=saveCursorPos();
contentEditable=true
name="divDisplay"><%=rsa.fields("story_name")%></DIV>

You'll note that there is a hidden form field with the clever name
"hiddenInput" (don't ask why there are size values....my graphics guy)
when the Save button is clicked, the data with in the div is put into the
hidden field through the cmdSave_onClick function.

I just realized this really has nothing to do with asp and is all
client-side stuff. Feel free to respond to me directly, or post in a
javascript group.

Tom B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,091
Messages
2,570,605
Members
47,225
Latest member
DarrinWhit

Latest Threads

Top