Have combobox allow only existing values
Closed, ResolvedPublic

Description

Author: trueskew

Description:
Consider a field that lets a user set a value based on category Wiki Page:

{{{field|Homepage|autocomplete on category=Wiki Page}}}

Today, this field specification will allow the user to save a value that does not exist. I propose that the field be defined so that the final value is limited to existing values. For example,

{{{field|Homepage|autocomplete on category=Wiki Page|mustexist}}}

The user could still type in a non-existing page, since it's a combobox. Existence is verified after the user hits "Save page". If the value does not exist within the specified set (category=Wiki Page above), an error message displays and the form stays open. This behavior would match that of a mandatory string field that is empty on "Save page".


Version: unspecified
Severity: enhancement

bzimport set Reference to bz26088.
bzimport created this task.Via LegacyNov 23 2010, 7:23 PM
Yaron_Koren added a comment.Via ConduitNov 24 2010, 4:48 PM

Ignore previous description, see new subject line.

Yaron_Koren added a comment.Via ConduitMar 8 2011, 6:59 PM

This feature has been added to SF in version 2.1, with the new "existing values only" parameter.

Badon added a comment.Via ConduitDec 9 2011, 6:45 AM

Reopened. I just tested this feature with Semantic Forms 2.2.1 and 2.3.1 and it is only partially working, just barely. The only time it works that I was able to find is when focus changes.

If the user immediately clicks the "Submit" button, or just hits the "Enter" key while focus is still in the field, any non-existing value can be submitted.

I tested input types combobox and text with autocomplete, with both single values and multiple.

It appears that this bug is being worked on already:

http://wikimedia.7.n6.nabble.com/quot-one-to-many-quot-validation-td678004.html#a678006

bzimport added a comment.Via ConduitDec 9 2011, 8:33 AM

vladimir.kostukov wrote:

one-to- many validation

Fixed bug with focus;
Added validation for fields with autocomplete;

Attached: validation.patch

Yaron_Koren added a comment.Via ConduitDec 9 2011, 5:39 PM

I don't think the issues with the focus are cause enough to re-open this feature request - the basic functionality is now there. And note that it applies to the 'combobox' input, not any other input type. I'm resetting this to 'fixed'.

Badon added a comment.Via ConduitDec 10 2011, 9:37 PM

Reopened.

There are no issues with the focus as far as I can tell. It appears to me that it works perfectly in all of my tests. The issue is that nothing else works, and the goal proposed in this report has definitively not been achieved:

The user could still type in a non-existing page, since it's a combobox.
Existence is verified after the user hits "Save page". If the value does not
exist within the specified set (category=Wiki Page above), an error message
displays and the form stays open. This behavior would match that of a
mandatory string field that is empty on "Save page".

The combobox still will:

  • allow non-existing values to be saved.
  • no error message is displayed
  • the form does not remain open to allow the user to fix the error in the same manner as the behavior invoked by the "mandatory" parameter

Although the focus feature is interesting, I think it should be removed. The focus feature will delete all of the data the user entered if there is a minor typographical error, with no opportunity to fix it.

In the case where a user meticulously enters in some data, and then switches to another browser tab to check that the data is entered in correctly, it would be more than a little annoying for the user to come back to the form and see all of the data has been erased.

Yaron_Koren added a comment.Via ConduitDec 11 2011, 2:55 AM

The idea that validation should be improved is a valid opinion, but nevertheless it belongs in a different feature request, if anywhere, since this feature already exist. Marking back to "fixed".

Add Comment