Back to index

plone3  3.1.7
Classes | Functions
plone.app.form.kss.validation Namespace Reference

Classes

class  FormlibValidation

Functions

def validate_and_issue_message

Function Documentation

def plone.app.form.kss.validation.validate_and_issue_message (   ksscore,
  widget,
  fieldname,
  kssplone = None 
)
A helper method also used by the inline editing view

Definition at line 46 of file validation.py.

00046 
00047 def validate_and_issue_message(ksscore, widget, fieldname, kssplone=None):
00048     """A helper method also used by the inline editing view
00049     """
00050 
00051     error = None
00052     try:
00053         widget.getInputValue()
00054     except:
00055         pass
00056     error = widget.error()
00057 
00058     field_div = ksscore.getHtmlIdSelector('formfield-%s' % fieldname.replace('.', '-'))
00059     error_box = ksscore.getCssSelector('#formfield-%s div.fieldErrorBox' % fieldname.replace('.', '-'))
00060     
00061     if error:
00062         ksscore.replaceInnerHTML(error_box, error)
00063         ksscore.addClass(field_div, 'error')
00064     else:
00065         ksscore.clearChildNodes(error_box)
00066         ksscore.removeClass(field_div, 'error')
00067         if kssplone is not None: 
00068             kssplone.issuePortalMessage('')
00069 
00070     return bool(error)

Here is the caller graph for this function: