Changeset 4867f3 in indico


Ignore:
Timestamp:
09/30/11 16:47:42 (20 months ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
eb968d
Parents:
3edc62
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (09/30/11 12:09:41)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (09/30/11 16:47:42)
Message:

[FIX] mandatory checkboxes in regform

Location:
indico
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/registration.py

    rb09a64 r4867f3  
    17001700        if ( registrant is not None and billable and registrant.getPayed()) or (not self.getParent().hasAvailablePlaces() and not quantity): 
    17011701            disable="disabled=\"disabled\"" 
    1702             #pass 
    17031702        if v=="yes": 
    17041703            checked="checked=\"checked\"" 
    1705  
    1706         tmp = """<input type="checkbox" id="%s" name="%s" %s %s> %s""" % (htmlName, htmlName, checked, disable, caption) 
     1704        pm = '' 
     1705        if self._parent.isMandatory(): 
     1706            pm = """<script>addParam($E('%s'), 'checkBox', false);</script>""" % htmlName 
     1707        tmp = """<input type="checkbox" id="%s" name="%s" %s %s> %s%s""" % (htmlName, htmlName, checked, disable, caption, pm) 
    17071708        tmp= """ <td>%s</td><td align="right" align="bottom">"""%tmp 
    17081709        if billable: 
     
    17241725            item.setValue("yes") 
    17251726            item.setQuantity(1) 
     1727        elif not override and self.getParent().isMandatory(): 
     1728            raise FormValuesError(_('The checkbox "%s" is mandatory. Please enable it.') % self.getParent().getCaption()) 
    17261729        else: 
    17271730            item.setValue("no") 
  • indico/htdocs/js/indico/Legacy/Util.js

    r453220 r4867f3  
    567567                    } 
    568568                } 
     569                else if (dataType == 'checkBox' && !exists(extraCheckFunction)) { 
     570                    if (!allowEmpty && !component.dom.checked) { 
     571                        error = Html.span({}, $T("Please enable the checkbox")); 
     572                    } 
     573                } 
    569574                else if (dataType == "radio" && !exists(extraCheckFunction)) { 
    570575                    if (!allowEmpty && !self.checkRadioButton(component)) { 
Note: See TracChangeset for help on using the changeset viewer.