I created a simple select-field (type: list (text)) within the "manage-fields" section of a content-type. This field is marked as required.
It has two values:

1|Yes
2|No

In the browser this field is shown with following options in html:
-- please select --
Yes
No

When now submitting this form, the client side validation does not say, that this field is required.
Could this be a bug or am I using it wrong? The module uses jquery.validate as base, right? jquery.validate assumes, that a required field, if it is not changes by the user, has the value "" or a string-length which is equal to zero. The default "required" value of the list-field in drupal seems to be "_none".

Has someone an idea, what is going wrong?

Comments

attiks’s picture

Assigned: Unassigned » Jelle_S

First time I hear this, but you're right. If you make the field required and don't specify a default value an extra option is added with key '_none'

attiks’s picture

I created #1585930: Options module uses '_none' as a special value to see if it can be fixed in Drupal core.

attiks’s picture

blacklist '_none' might solve this

Jelle_S’s picture

fixed in latest dev by blacklisting '_none'

Jelle_S’s picture

Status: Active » Fixed
Jelle_S’s picture

Assigned: Jelle_S » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

garamani’s picture

Issue summary: View changes

Have you committed this fix to the latest Recommended release of module?
The problem still exist in 7.x-1.39.

The form that I want to be validated is "Hierarchical select".

  • HS form is requied.
  • When I don't select any item from list and click on save, The clientside validation doesn't validate HS form.
  • I checked the HTML code and there is no "error" label available.

In this Issue some people requested to exclude HS from being validated.
Have you excluded the HS from clientside validation?

garamani’s picture

I created a simple list with None as default option and the List gets validated!
So, the problem is only related to Hierarchical select which doesn't get validated by Clientside Validation.