Forum Discussion

antoined's avatar
antoined
Ideator I
5 years ago
Solved

Constraints not working on an integer field form

Hello, I created a new "feedback" ItemType for my users to write remarks about Aras.

I want them to rank the priority of the feedback with an integer from 1 to 5. For this, I created a _priority property in the itemtype which is of type "Integer". I set the range Min to 1 and Max to 5, and checked the "inclusive" box. I also put a value of 1.

Then I created a form and added the _priority as a text field (I first tried with a combobox but it didn't provide any selectable values, I would be happy if you can help me about that too).

The form works well, the default value of 1 is here, but the user is able to enter any kind of integer (200, or even -8) and can still submit the form. I also tried to add a pattern ([1-5], and even/^[1-5]$/) but that didn't change anything, the validation isn't working. Is there something wrong in my databinding?

Does anyone know why? Thank you.

  • Take a look at the Express ECO Form. There is this kind of Priority List used:

    You can use lists to specify these kind of predefined values:

    Just take a look at ItemType and Form "Express ECO" to see how these kinds of list are used. Datasource would be the predefined list. In this case you don´t have Integer values, but you can use the list for filtering and searching.

    You original idea can also work, but from my POV is unnecessary complicated for the use case.

5 Replies

  • HI Antoined,

    it´s possible to do this kinds of restraints in the Form. But another question first: Why don´t you solve this use case with a list? You can find similar priority lists in the CM processes. Maybe this would be the easier solution?

  • [quote userid="4412" url="~/f/development/36384/constraints-not-working-on-an-integer-field-form/6524#6524"]it´s possible to do this kinds of restraints in the Form

    You mean natively, or writing the check with Javascript?

    [quote userid="4412" url="~/f/development/36384/constraints-not-working-on-an-integer-field-form/6524#6524"]You can find similar priority lists in the CM processes

    I don't know what the CM processes is. What should I put as a datasource if I want to set the property as a list instead of integer?

    • AngelaIp's avatar
      AngelaIp
      Ideator I

      Take a look at the Express ECO Form. There is this kind of Priority List used:

      You can use lists to specify these kind of predefined values:

      Just take a look at ItemType and Form "Express ECO" to see how these kinds of list are used. Datasource would be the predefined list. In this case you don´t have Integer values, but you can use the list for filtering and searching.

      You original idea can also work, but from my POV is unnecessary complicated for the use case.

      • antoined's avatar
        antoined
        Ideator I

        Thanks, creating a list worked. Personally I find that to have to create a list looks more complicated that to simply validate an integer, but I see the Aras philosophy here.