Back to index

python-weblib  1.3.9
Public Member Functions | Public Attributes
pyweblib.forms.Textarea Class Reference
Inheritance diagram for pyweblib.forms.Textarea:
Inheritance graph
[legend]
Collaboration diagram for pyweblib.forms.Textarea:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def setRegex
def inputHTML
def valueHTML
def idAttrStr
def labelHTML
def getValue
def setDefault
def setValue
def setCharset
def titleHTML

Public Attributes

 rows
 cols
 value
 name
 text
 maxLen
 maxValues
 required
 accessKey
 inputHTMLTemplate
 valueHTMLTemplate
 charset
 default

Detailed Description

Multi-line input field:
<textarea>

Definition at line 239 of file forms.py.


Constructor & Destructor Documentation

def pyweblib.forms.Textarea.__init__ (   self,
  name,
  text,
  maxLen,
  maxValues,
  pattern,
  required = 0,
  default = None,
  accessKey = '',
  rows = 10,
  cols = 60 
)

Definition at line 248 of file forms.py.

00248 
00249   ):
00250     self.rows  = rows
00251     self.cols  = cols
00252     Field.__init__(
00253       self,name,text,maxLen,maxValues,None,required,default,accessKey
00254     )


Member Function Documentation

def pyweblib.forms.Field.getValue (   self) [inherited]
Returns self.value in case of multi-valued input or
self.value[0] if only one value is allowed.

Definition at line 103 of file forms.py.

00103 
00104   def getValue(self):
00105     """
00106     Returns self.value in case of multi-valued input or
00107     self.value[0] if only one value is allowed.
00108     """
00109     if self.maxValues>1:
00110       return self.value
00111     else:
00112       return self.value[0]

def pyweblib.forms.Field.idAttrStr (   self,
  id_value 
) [inherited]

Definition at line 93 of file forms.py.

00093 
00094   def idAttrStr(self,id_value):
00095     if id_value is None:
00096       return ''
00097     else:
00098       return 'id="%s" ' % (id_value)

Here is the caller graph for this function:

def pyweblib.forms.Textarea.inputHTML (   self,
  default = None,
  id_value = None,
  title = None 
)
Returns string with HTML input field.

Definition at line 265 of file forms.py.

00265 
00266   def inputHTML(self,default=None,id_value=None,title=None):
00267     """Returns string with HTML input field."""
00268     return self.inputHTMLTemplate % (
00269       '<textarea %stitle="%s" name="%s" %s rows="%d" cols="%d">%s</textarea>' % (
00270         self.idAttrStr(id_value),
00271         self.titleHTML(title),
00272         self.name,
00273         self._accessKeyAttr(),
00274         self.rows,self.cols,
00275         self._defaultHTML(default)
00276       )
00277     )

Here is the call graph for this function:

def pyweblib.forms.Field.labelHTML (   self,
  labelText = None,
  for_value = None 
) [inherited]

Definition at line 99 of file forms.py.

00099 
00100   def labelHTML(self,labelText=None,for_value=None):
00101     labelText = (labelText or self.text).encode(self.charset)
00102     return '<label for="%s">%s</label>' % (for_value or self.name,labelText)

def pyweblib.forms.Field.setCharset (   self,
  charset 
) [inherited]
Define the character set of the user's input.

Definition at line 212 of file forms.py.

00212 
00213   def setCharset(self,charset):
00214     """Define the character set of the user's input."""
00215     self.charset = charset

def pyweblib.forms.Field.setDefault (   self,
  default 
) [inherited]
Set the default of a field.

Mainly this is used by the application if self.default shall
be changed after initializing the field object.

Reimplemented in pyweblib.forms.Radio.

Definition at line 113 of file forms.py.

00113 
00114   def setDefault(self,default):
00115     """
00116     Set the default of a field.
00117 
00118     Mainly this is used by the application if self.default shall
00119     be changed after initializing the field object.
00120     """
00121     if type(default)==types.ListType:
00122       self.default = [i for i in default if i!=None]
00123     else:
00124       self.default = default or ''

Here is the caller graph for this function:

def pyweblib.forms.Textarea.setRegex (   self,
  pattern 
)
Like Field.setRegex() but pattern options re.S and re.M are
automatically added.

Reimplemented from pyweblib.forms.Field.

Definition at line 255 of file forms.py.

00255 
00256   def setRegex(self,pattern):
00257     """
00258     Like Field.setRegex() but pattern options re.S and re.M are
00259     automatically added.
00260     """
00261     patternstring,patternoptions = self._patternAndOptions(pattern)
00262     # This is a Unicode input field
00263     patternoptions = patternoptions | re.M|re.S
00264     Field.setRegex(self,(patternstring,patternoptions))

Here is the call graph for this function:

def pyweblib.forms.Field.setValue (   self,
  value 
) [inherited]
Store the user's value into the field object.

This method can be used to modify the user's value
before storing it into self.value.

Definition at line 196 of file forms.py.

00196 
00197   def setValue(self,value):
00198     """
00199     Store the user's value into the field object.
00200 
00201     This method can be used to modify the user's value
00202     before storing it into self.value.
00203     """
00204     value = self._encodeValue(value)
00205     # Check if input is valid
00206     # Length valid?
00207     self._validateLen(value)
00208     # Format valid?
00209     self._validateFormat(value)
00210     self._validateMaxValue()
00211     self.value.append(value)

Here is the call graph for this function:

def pyweblib.forms.Field.titleHTML (   self,
  title 
) [inherited]
HTML output of default.

Definition at line 220 of file forms.py.

00220 
00221   def titleHTML(self,title):
00222     """HTML output of default."""
00223     return escapeHTML(title or self.text).encode(self.charset)

Here is the call graph for this function:

Here is the caller graph for this function:

HTML output of self.value using the HTML template string
in self.valueHTMLTemplate.

Reimplemented from pyweblib.forms.Field.

Definition at line 278 of file forms.py.

00278 
00279   def valueHTML(self):
00280     """
00281     HTML output of self.value using the HTML template string
00282     in self.valueHTMLTemplate.
00283     """
00284     return [
00285       self.valueHTMLTemplate % '<pre>%s</pre>' % v
00286       for v in self.value
00287     ]
00288 


Member Data Documentation

Definition at line 78 of file forms.py.

Definition at line 83 of file forms.py.

Definition at line 250 of file forms.py.

Reimplemented in pyweblib.forms.Radio.

Definition at line 121 of file forms.py.

Definition at line 79 of file forms.py.

Reimplemented in pyweblib.forms.Radio.

Definition at line 75 of file forms.py.

Definition at line 76 of file forms.py.

Definition at line 73 of file forms.py.

Definition at line 77 of file forms.py.

Definition at line 249 of file forms.py.

Definition at line 74 of file forms.py.

Definition at line 72 of file forms.py.

Definition at line 80 of file forms.py.


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