contentEditable  
Author Message
Trevor





PostPosted: 2005-8-27 5:59:00 Top

html, contentEditable I have an DIV with the contentEditable attribute. How can I get the
value of the content within that DIV after the user has edited it for
further processing. I'd like to store the HTML code within the DIV to a
hidden INPUT. Thanks for your help!

 
trevordixon





PostPosted: 2005-8-27 6:23:00 Top

html >> contentEditable I have an DIV with the contentEditable attribute. How can I get the
value of the content within that DIV after the user has edited it for
further processing. I'd like to store the HTML code within the DIV to a
hidden INPUT. Thanks for your help!

 
Evertjan.





PostPosted: 2005-8-27 7:25:00 Top

html >> contentEditable wrote on 27 aug 2005 in comp.lang.javascript:

> I have an DIV with the contentEditable attribute. How can I get the
> value of the content within that DIV after the user has edited it for
> further processing. I'd like to store the HTML code within the DIV to a
> hidden INPUT. Thanks for your help!
>
>

<div id=d contentEditable>
...
<input type=hidden id=p>
...


function ... {

document.getElementById('p').value =
document.getElementById('d').innerHTML

}

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
 
Jonathan N. Little





PostPosted: 2005-8-27 8:22:00 Top

html >> contentEditable Trevor wrote:
> I have an DIV with the contentEditable attribute. How can I get the
> value of the content within that DIV after the user has edited it for
> further processing. I'd like to store the HTML code within the DIV to a
> hidden INPUT. Thanks for your help!
>
1: I know of no such DIV attribute 'contentEditable'.
2: Why would you use a DIV for user input? There are a whole host of
defined form element for that purpose! Try a FORM with a
TEXTAREA...unless your intentions involve subterfuge...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
 
Toby Inkster





PostPosted: 2005-8-27 14:26:00 Top

html >> contentEditable Jonathan N. Little wrote:

> 1: I know of no such DIV attribute 'contentEditable'.

It's invalid, true, but it works in IE. Mozilla has a similar, though
slightly different extension.

> 2: Why would you use a DIV for user input? There are a whole host of
> defined form element for that purpose! Try a FORM with a
> TEXTAREA...unless your intentions involve subterfuge...

TEXTAREA can't contain bold text, text of varying sizes, italics, etc.
contentEditable allows you to create a little WYSIWYG editor within a page.
It's not much good on the public internet, but is fairly handy for
intranets, and for the admin sections of public sites (e.g. within a CMS
tool).

The OP wants to look at document.getElementById('foo').innerHTML I think.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
 
Jonathan N. Little





PostPosted: 2005-8-27 21:42:00 Top

html >> contentEditable Toby Inkster wrote:
<snip>
> TEXTAREA can't contain bold text, text of varying sizes, italics, etc.
> contentEditable allows you to create a little WYSIWYG editor within a page.
> It's not much good on the public internet, but is fairly handy for
> intranets, and for the admin sections of public sites (e.g. within a CMS
> tool).
>
> The OP wants to look at document.getElementById('foo').innerHTML I think.
>
New one on me, but I have not invested much time on the MSIE only
elements and attributes, I write for the web. Problems I see...

1: MSIE only
2: Requires JavaScript
3: Can create really horrific tag soup with cut'n paste operations /but
then again, this is MSIE, MS is use to parsing junk!/ ;-)

If you want to pass formatted data I ould think something like a Java
app would be better with wider support.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
 
Trevor





PostPosted: 2005-9-4 1:14:00 Top

html >> contentEditable Is there way to make a DIV with the contentEditable attribtute do
single line breaks when you press enter rather than a paragraph break?

 
 
Trevor





PostPosted: 2005-9-4 1:14:00 Top

html >> contentEditable Is there any way to make a DIV with the contentEditable attribtute do
single line breaks when you press enter rather than a paragraph break?

 
 
Randy Webb





PostPosted: 2005-9-4 4:08:00 Top

html >> contentEditable Trevor said the following on 9/3/2005 1:14 PM:
> Is there any way to make a DIV with the contentEditable attribtute do
> single line breaks when you press enter rather than a paragraph break?

Yes.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
 
 
Trevor





PostPosted: 2005-9-5 14:00:00 Top

html >> contentEditable Thanks, how?

 
 
TWljaGFlbCBSaWNodGVy





PostPosted: 2005-12-7 17:26:00 Top

html >> contentEditable hi, all,

this is my first attempt in this newsgroup so please be forbearing if I am
posting to the wrong newsgroup or the question might be some kind of rtfm ;-).
I actually have a little problem in understanding the contenteditable
property. MSDN2 declares this as a good thing to use if wanting a form to be
not editable by the user. But there seem to be some restrictions.
I'm using VS.NET 2005 for my actual project and created a masterpage and
several content pages. Navigation and data access works fine but for
different users I want to have forms that are not editable but only showing
actual data. I could build a second form or page for this but I think to have
understood that the contenteditable property is my solution for the problem.
The content pages are all build with several controls like textbox,
dropdownlist, calendars and buttons embedded in a simple table to format the
page. I tried div and form with property contenteditable=false but the form
stayed editable. So I started to search MSDN2 and the www with Google but no
article solved my problem (or I overread it ;-) ). It seems that there must
be some kind of restrictions in the usage of contenteditable or some
prerequisites I did not care for yet.
Ok, now, has anybody a hint or a solution for my problem?

kind regards

Michael
 
 
Daniel Fisher(lennybacon)





PostPosted: 2005-12-7 21:28:00 Top

html >> contentEditable The contenteditable attributecan be used to make the contents of a DIV
editable.

What you are searching for is the ReadOnly property of the asp:TextBox etc.
You can set these values by looping through the control tree:

SetToReadOnly(this.Page.Controls);


...

void SetToReadOnly(ContolCollection controls)
{
for(int i=0; i<contols.count; i++)
{
if( contols[i] is TextBox)
{
((TextBox)contols[i] ).ReadOnly=true;
}
if(contols[i].HasControls)
{
SetToReadOnly(contols[i].Controls);
}
}
}


--
Daniel Fisher(lennybacon)
http://www.lennybacon.com


"Michael Richter" <email***@***.com> wrote in
message news:email***@***.com...
> hi, all,
>
> this is my first attempt in this newsgroup so please be forbearing if I am
> posting to the wrong newsgroup or the question might be some kind of rtfm
> ;-).
> I actually have a little problem in understanding the contenteditable
> property. MSDN2 declares this as a good thing to use if wanting a form to
> be
> not editable by the user. But there seem to be some restrictions.
> I'm using VS.NET 2005 for my actual project and created a masterpage and
> several content pages. Navigation and data access works fine but for
> different users I want to have forms that are not editable but only
> showing
> actual data. I could build a second form or page for this but I think to
> have
> understood that the contenteditable property is my solution for the
> problem.
> The content pages are all build with several controls like textbox,
> dropdownlist, calendars and buttons embedded in a simple table to format
> the
> page. I tried div and form with property contenteditable=false but the
> form
> stayed editable. So I started to search MSDN2 and the www with Google but
> no
> article solved my problem (or I overread it ;-) ). It seems that there
> must
> be some kind of restrictions in the usage of contenteditable or some
> prerequisites I did not care for yet.
> Ok, now, has anybody a hint or a solution for my problem?
>
> kind regards
>
> Michael


 
 
TWljaGFlbCBSaWNodGVy





PostPosted: 2005-12-7 22:13:00 Top

html >> contentEditable hi daniel,

so it was a problem with my English! content != elements != controls ... ;-)
grumble ...

ok, I wanted to avoid that looping, but if there is no other possibility ...

thanks a lot and greetings from cologne (hit your webpage and read wuppertal
as your home)

michael

"Daniel Fisher(lennybacon)" wrote:

> The contenteditable attributecan be used to make the contents of a DIV
> editable.
>
> What you are searching for is the ReadOnly property of the asp:TextBox etc.
> You can set these values by looping through the control tree:
>
> SetToReadOnly(this.Page.Controls);
>
>
> ....
>
> void SetToReadOnly(ContolCollection controls)
> {
> for(int i=0; i<contols.count; i++)
> {
> if( contols[i] is TextBox)
> {
> ((TextBox)contols[i] ).ReadOnly=true;
> }
> if(contols[i].HasControls)
> {
> SetToReadOnly(contols[i].Controls);
> }
> }
> }
>
>
> --
> Daniel Fisher(lennybacon)
> http://www.lennybacon.com