Page MenuHomePhabricator

Mandatory fields not working with version 1.9
Closed, ResolvedPublic

Description

Author: mitchell_neill

Description:
Hi.

I've got SF 1.9 installed on MW 1.15.1 SMW 1.4.3. I have forms with mandatory
fields. However, if I leave those fields blank and hit Save page, it
momentarily flashes the "cannot be blank" text next to the fields, but
the save still happens!

This can be seen at www.prescientsoftware.co.uk/schoolgate_dev

Click on "Submit an event" and then click Save page without entering any data. You see the warnings, but the page saves anyway.

Cheers
Neill.


Version: unspecified
Severity: critical

Details

Reference
bz22960

Event Timeline

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

Hi,

I can't duplicate this; I'm guessing it's happening due to some Javascript issues coming from some other extension - maybe Semantic Forms Inputs' "datepicker" input, which looks like it's generating a lot of Javascript. I'd try removing that from the form and seeing if it makes a difference. By the way, "Special:Version" is inaccessible on your wiki, which is odd - possibly a related issue?

mitchell_neill wrote:

Hi Yaron.

Turned off the datepicker. Still does it, so that is not the problem.

The site is pretty tightly locked down, but I've opened up Version for you.

Very odd problem this isn't it.

Cheers
Neill.

mitchell_neill wrote:

Hi Yaron.

This is down to the Show on Select functionality. For example, if you have:

{| 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

autocomplete|property=Ethnic White}}}

}</div>

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

{{{fieldEthnic Origininput type=checkboxesno

autocomplete|property=Ethnic Black}}}

}</div>

You can save the form even if first name or surname are left blank.

If I remove the show on select stuff it won't let you save if first name or surname are left blank.

mitchell_neill wrote:

Okay, this happens if any fields are set to "hidden". All mandatory fields then stop working.

See example at http://scratchpad.referata.com/wiki/Mandatory_Field_Test

Click the Add a Mandatory Test Item button. Then in the form press save without filling in any of the fields. It momentarily flashes "Cannot be blank" next to the Title field, but saves anyway.

Form is Form:Mandatory Field Test Form.

This is quite serious if you are using the automatic page naming functionality of the form, as the fields used to create the page name can be left blank resulting in dud page names. For example, with the above form you end up with an article called ","

mitchell_neill wrote:

Okay, it happens if you have both mandatory and hidden set for a field. Obviously the mandatory is not really needed if the field is hidden, so can be removed.

I thought that was it, but I've found that the Show on Select functionality also stops mandatory fields working. It only does it if one of the Show on Select fields is set to mandatory.

e.g.:
{| 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.

So bug 24111 is still valid, but I will close this one off.