Page MenuHomePhabricator

Show on select functionality stops mandatory field checking working.
Closed, ResolvedPublic

Description

Author: mitchell_neill

Description:
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:

{{{fieldTitle}}}
-

! First Name:

{{{fieldFirst Namemandatory}}}
-

! Surname:

{{{fieldSurnamemandatory}}}
}

{| class="formtable"
! Ethnic Origin:

{{{fieldEthnic Origin Groupdefault=Not Disclosedshow 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"
!

{{{fieldEthnic Origininput type=checkboxesno autocompleteproperty=Ethnic White}}}
}</div>

<div id="black">
{| class="formtable"
!

{{{fieldEthnic Origininput type=checkboxesno autocompleteproperty=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.


Version: unspecified
Severity: critical

Details

Reference
bz24111

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:02 PM
bzimport set Reference to bz24111.

mitchell_neill wrote:

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:

{{{fieldArea Groupsdefault=Noneshow 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:

{{{fieldAreasinput type=checkboxesno autocompleteproperty=Areamandatory}}}
}

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