Last modified: 2011-11-22 07:28:14 UTC
Hi. I'm using MW 1.15.3, SMW 1.5.1.1 and SF 1.9.1. If I add show on select functionality to my forms then the mandatory field checking stops working. The form can be saved even if any of the specified mandatory fields are not filled in. For example: {| class="formtable" ! Title: | {{{field|Title}}} |- ! First Name: | {{{field|First Name|mandatory}}} |- ! Surname: | {{{field|Surname|mandatory}}} |} {| class="formtable" ! Ethnic Origin: | | {{{field|Ethnic Origin Group|default=Not Disclosed|show on select=White=>white;Black or Black British=>black;Mixed=>mixed;Chinese=>chinese;Asian or Asian British=>asian;Other=>other}}} |} <div id="white"> {| class="formtable" ! | {{{field|Ethnic Origin|input type=checkboxes|no autocomplete|property=Ethnic White}}} |}</div> <div id="black"> {| class="formtable" ! | {{{field|Ethnic Origin|input type=checkboxes|no autocomplete|property=Ethnic Black}}} |}</div> You can save the form even if first name or surname are left blank. First Name and Surname are string properties. Any ideas what is causing this? It's a bit of a show stopper. Many thanks Neill.
After much testing I've found it only does it if one of the Show on Select fields is set to mandatory. For example: {| class="formtable" ! width=25%|Area Grouping: | {{{field|Area Groups|default=None|show on select=None=>none;North and East Hampshire=>ne_hampshire;West Hampshire=>w_hampshire;South East Hampshire=>se_hampshire}}} |} <div id="none"> {| class="formtable" ! width=10%|Areas: | {{{field|Areas|input type=checkboxes|no autocomplete|property=Area|mandatory}}} |} If any mandatory fields in the form are left blank (not just Areas), you can still save.
I believe this is now fixed in version 2.0 - setting to "fixed".
I have found this bug again: <!-- uploadoredit radio button field parameters "mandatory" with "default=edit" fails to prevent "None" radiobutton from appearing on edit pages. No workaround available other than hiding the entire field. --><nowiki /> <div class="hidden"> <!-- makes it so hidden uploadoredit fields below don't take up any space. Not necessary anymore to hide them with the uploadoredit CSS class, but whatever. --><nowiki /> {{{field | uploadoredit | class=uploadoredit | input type=radiobutton | values=upload, edit | default=edit | show on select=upload=>uploadfield;}}} <!-- Must duplicate this line to make buggy show on select hiding work. Workaround discovered by accident when accidentally pasting form code twice in form edit page. I don't know why it works. --><nowiki /> {{{field | uploadoredit | class=uploadoredit | input type=radiobutton | values=upload, edit | default=edit | show on select=upload=>uploadfield;}}} <!-- Must duplicate this line to make buggy show on select hiding work. Workaround discovered by accident when accidentally pasting form code twice in form edit page. I don't know why it works. --><nowiki /> </div>
You can't have the same field in a form more than once; it leads to undefined behavior, so I'm not surprised that things would break. I'm setting this to "invalid".
Makes sense, thanks. Changed it back to "fixed", which is what it was before I reopened it.
Looks like there was actually a new bug behind this, but although it produces a similar effect, I made a new report for it: https://bugzilla.wikimedia.org/show_bug.cgi?id=32580