omeka-s-modules / Sharing

Omeka S module for sharing content via 1) Social Media and 2) Embedding Omeka S content in other sites
GNU General Public License v3.0
4 stars 6 forks source link

Extending elements to signal required doesn't work on checkboxes #30

Closed patrickmj closed 8 years ago

patrickmj commented 8 years ago

Per convo about #29, on branch filter-fix I switched to extending Zend's MultiCheckbox. That fixed everything as long as I said that the element was not required, but when I switch to requiring the element, it requires that all the checkboxes be checked, which is not what we want.

Not sure if that's a problem with how I'm building the form, or with the general Omeka S javascripts that check required stuff. Could use advice from @zerocrates and @jimsafley

jimsafley commented 8 years ago

Not sure this has anything to do with the multicheckbox problem, but you need to explicitly call setIsRequired() on the element object. It doesn't pick up that setting when using factory-style element creation.

patrickmj commented 8 years ago

Yeah, looks like that is the problem. I shoulda noticed that setIsRequired() also sets the attribute, so with this pattern the required attribute shouldn't go in the attributes array. As you said in slack, not intuitive!