Skip to content

Mandatory Formulas

tomolimo edited this page Nov 23, 2021 · 5 revisions

Mandatory formulas are used to show or hide the mandatory sign for a field.

Mandatory formulas are alike Formulas apart the fact that the # alone (= self) is not allowed. In mandatory formulas a field can't be self-reference (#), it must reference other fields like #xxx where xxx represents the field index.

Example

Let's imagine that when 'Simplified Interface' at ticket creation you would like to force requester to input a ticket description when ticket is of type 'Request', and that this description must be at least of 10 chars and that it must contains a minimum of 5 words.

The ticket creation form will be like following (note that 'Title' is under field validation):

The ticket creation form when switched to 'Request'

As you can see, the mandatory sign has been shown as the ticket type has been switched to 'Request'

Let's see the formula that permits this behavior:

  1. Go to GLPi menu 'Setup > Form Validations'
  2. open Page 'Ticket Validations' page ID 4
  3. open Form 'Simplified interface Creation' form ID 4.
  4. Look at the field list, and you should have the following screen:

Here the form is a little bit special, as it permits to edit several field lines at the same time and to save all of them at once.

If you look at the the field 'Description' ID 10, you'll see the mandatory formula: #11 == 2 which means if field #11 (field 'Type') value is 2 (= 'Request') then shows the mandatory sign.

About 'Validation Formula' for this 'Description' field see Formulas

Clone this wiki locally