Fix the UI indicators for mandatory fields.

The source and target groups weren't highlighted but the entire block of
checkboxes was and it looked absolutely horrible.
This commit is contained in:
Rob Crittenden
2007-12-12 15:18:28 -05:00
parent 6976f92862
commit b5af99c51d
3 changed files with 12 additions and 4 deletions

View File

@@ -65,8 +65,9 @@ class DelegateValidator(validators.Schema):
messages = { 'empty': _("Please choose a group"), })
dest_group_dn = validators.String(not_empty=True,
messages = { 'empty': _("Please choose a group"), })
attrs = validators.NotEmpty(
messages = { 'empty': _("Please select at least one value"), })
# There is no attrs validator here because then it shows as one
# huge block of color in the form. The validation is done in
# the subcontroller.
class DelegateForm(widgets.Form):
params = ['delegate_fields', 'attr_list']

View File

@@ -292,4 +292,11 @@ class DelegationController(IPAController):
@validate(form=delegate_form)
@identity.require(identity.not_anonymous())
def delegatevalidate(self, tg_errors=None, **kw):
# We are faking this because otherwise it shows up as one huge
# block of color in the UI when it has a not empty validator.
if not kw.get('attrs'):
if not tg_errors:
tg_errors = {}
tg_errors['attrs'] = _("Please select at least one value")
cherrypy.request.validation_errors = tg_errors
return tg_errors, kw

View File

@@ -104,7 +104,7 @@
py:content="tg.errors.get('source_group_dn')" />
</div>
<div id="source_searcharea" style="display:none">
<input id="source_criteria" type="text"
<input class="requiredfield" id="source_criteria" type="text"
onkeypress="return enterDoSearch(event, 'source');" />
<input class="searchbutton" type="button" value="Find"
onclick="return doSearch('source');"
@@ -142,7 +142,7 @@
</div>
<div id="dest_searcharea" style="display:none">
<div>
<input id="dest_criteria" type="text"
<input class="requiredfield" id="dest_criteria" type="text"
onkeypress="return enterDoSearch(event, 'dest');" />
<input class="searchbutton" type="button" value="Find"
onclick="return doSearch('dest');"