cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory field in widget template

hgonzalez_
Confirmed Champ
Confirmed Champ

How can I make a field mandatory in a widget template? On the creation layout I have a widget template mapped to a schema field. In custom properties configuration I have added the property "required" with value "true". At runtime, it shows the required star "*" in the creation form, but it doesn't validate that the value is not empty. How can I validate it?

1 ACCEPTED ANSWER

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Hi,

Just add required="#{widget.required}" to the JSF tag bound to the #{field} mapping.

Here's an example:

<h:selectOneMenu value="#{field}" id="#{widget.id}"
  required="#{widget.required}">
  <f:selectItem itemValue="deleted" itemLabel="#{messages['label.no']}" />
  <f:selectItem itemValue=" " itemLabel="#{messages['label.yes']}" />
</h:selectOneMenu>
<h:message styleClass="errorMessage" for="#{widget.id}"
  id="#{widget.id}_message" />

View answer in original post

4 REPLIES 4

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Hi,

Just add required="#{widget.required}" to the JSF tag bound to the #{field} mapping.

Here's an example:

<h:selectOneMenu value="#{field}" id="#{widget.id}"
  required="#{widget.required}">
  <f:selectItem itemValue="deleted" itemLabel="#{messages['label.no']}" />
  <f:selectItem itemValue=" " itemLabel="#{messages['label.yes']}" />
</h:selectOneMenu>
<h:message styleClass="errorMessage" for="#{widget.id}"
  id="#{widget.id}_message" />

Thanks, it worked.

Using a standard h

Thanks it worked.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.