Class
zope.app.rotterdam.editingwidgets.SimpleEditingWidget

Improved textarea editing, with async saving using JavaScript.

Multi-line text (unicode) input.

>>> from zope.publisher.browser import TestRequest
>>> from zope.schema import Text
>>> field = Text(__name__='foo', title=u'on')
>>> request = TestRequest(form={'field.foo': u'Hello\r\nworld!'})
>>> widget = SimpleEditingWidget(field, request)
>>> widget.style = ''
>>> widget.hasInput()
True
>>> widget.getInputValue()
u'Hello\nworld!'
>>> def normalize(s):
...   return '\n  '.join(filter(None, s.split(' ')))
>>> print normalize( widget() )
<textarea
  cols="60"
  id="field.foo"
  name="field.foo"
  rows="15"
  >Hello
world!</textarea>
>>> print normalize( widget.hidden() )
<input
  class="hiddenType"
  id="field.foo"
  name="field.foo"
  type="hidden"
  value="Hello&#13;&#10;world!"
  />

Calling setRenderedValue will change what gets output:

>>> widget.setRenderedValue("Hey\ndude!")
>>> print normalize( widget() )
<textarea
  cols="60"
  id="field.foo"
  name="field.foo"
  rows="15"
  >Hey
dude!</textarea>

Check that HTML is correctly encoded and decoded:

>>> request = TestRequest(
...     form={'field.foo': u'<h1>&copy;</h1>'})
>>> widget = SimpleEditingWidget(field, request)
>>> widget.style = ''
>>> widget.getInputValue()
u'<h1>&copy;</h1>'
>>> print normalize( widget() )
<textarea
  cols="60"
  id="field.foo"
  name="field.foo"
  rows="15"
  >&lt;h1&gt;&amp;copy;&lt;/h1&gt;</textarea>

Base classes

Implemented Interfaces

Attributes/Properties

Methods

Known Subclasses

There are no known subclasses.