Hello,
I have a question about drop down lists and required fields. I have implemented a drop down list property in an edit form. It is a field of type d:text with a constraint of a list of Allowed values. It works, but I would like to enhance it.
Desired behavior:
I would like for the first value to be something indicating that the user needs to select something, like "– Please Select a Value –". Then, when the user clicks Save, if the selected value is "– Please select a Value –" (the first one in the list and the default), they get a message stating that they need to select a value. This is how I would like to implement Required or Mandatory fields with a drop down list.
Current State:
For now, I have configured the list to have a value of blank as the first value and it works, but I would like this value not to be blank, but rather tell the user that they need to select something.
Current configuration in custom model XML:
(note: implemented mandatory=true with a blank value first.)
List Constraint:
<constraint name="mt:constraintDocStatusList" type="LIST">
<parameter name="allowedValues">
<list>
<value></value>
<value>Draft</value>
<value>Pending Review</value>
<value>Approved</value>
<value>Published</value>
<value>Retired</value>
</list>
</parameter>
<parameter name="caseSensitive">
<value>false</value>
</parameter>
</constraint>
Aspect Property:
<property name="mt:docStatusList">
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint ref="mt:constraintDocStatusList" />
</constraints>
</property>
Thanks for any help you can provide.
-John