Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Properties | Private Attributes
plone.app.form.widgets.checkboxwidget.CheckBoxWidget Class Reference
Inheritance diagram for plone.app.form.widgets.checkboxwidget.CheckBoxWidget:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def error
def __call__

Public Attributes

 required
 name

Static Public Attributes

 disabled = False

Properties

 label = property(lambda self: "")
 hint = property(lambda self: "")

Private Attributes

 __required
 __name

Detailed Description

Plone specific widget that is going to show the checkbox widget on the left of the label
    in order to do that we remove the title / label / required

Definition at line 8 of file checkboxwidget.py.


Constructor & Destructor Documentation

def plone.app.form.widgets.checkboxwidget.CheckBoxWidget.__init__ (   self,
  context,
  request 
)

Definition at line 13 of file checkboxwidget.py.

00013 
00014     def __init__(self, context, request):
00015         BaseWidget.__init__(self, context, request)
00016         self.required = self.__required = False
00017         self.__name = self.name
00018         self.name = ""

Here is the caller graph for this function:


Member Function Documentation

Render the widget to HTML.

Definition at line 28 of file checkboxwidget.py.

00028 
00029     def __call__( self ):
00030         """Render the widget to HTML."""
00031         value = self._getFormValue()
00032         html = "<label for='%s'>%s</label>\n" % (self.name , translate(super(BaseWidget,self).label, context=self.request))
00033         if self.__required:
00034             html += "<span class='fieldRequired' title='%s'>%s</span>" % (translate(_(u'title_required'), context=self.request, default='Required'), translate(_(u'label_required'), context=self.request, default='(Required)'))
00035         if super(BaseWidget, self).hint:
00036             html += "<div class='formHelp'>%s</div>" % translate(super(BaseWidget, self).hint, context=self.request)
00037         if super(BaseWidget, self).error() != '':
00038             html += "<div>%s</div>" % translate(super(BaseWidget, self).error(), context=self.request)
00039         
00040         if value == 'on':
00041             kw = {'checked': 'checked'}
00042         else:
00043             kw = {}
00044         if self.disabled:
00045             kw['disabled'] = 'disabled'
00046         return "%s  %s %s" % (
00047             renderElement(self.tag,
00048                           type='hidden',
00049                           name=self.name+".used",
00050                           id=self.name+".used",
00051                           value=""
00052                           ),
00053             renderElement(self.tag,
00054                           type=self.type,
00055                           name=self.name,
00056                           id=self.name,
00057                           cssClass=self.cssClass,
00058                           extra=self.extra,
00059                           value="on",
00060                           **kw),
00061             html
00062             )
00063 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 25 of file checkboxwidget.py.

00025 
00026     def error(self):
00027         return ""

Here is the caller graph for this function:


Member Data Documentation

Definition at line 16 of file checkboxwidget.py.

Definition at line 15 of file checkboxwidget.py.

Definition at line 17 of file checkboxwidget.py.

Definition at line 15 of file checkboxwidget.py.


Property Documentation

plone.app.form.widgets.checkboxwidget.CheckBoxWidget.hint = property(lambda self: "") [static]

Definition at line 21 of file checkboxwidget.py.

plone.app.form.widgets.checkboxwidget.CheckBoxWidget.label = property(lambda self: "") [static]

Definition at line 19 of file checkboxwidget.py.


The documentation for this class was generated from the following file: