Show error message when a field is updated

Issue #403 resolved
Bharath Kumar created an issue

Hi Fidel I have a scenario where I need to show an error message.

The scenario is whenever I fill a particular field, lets say I select "Yes" in field A then I should be shown with a error message at an other field (field B) is required since you filled yes in field A. Which is making the field B mandatory when the field A is selected yes.

If the field B is already filled then there should not be any error message.

The approach that I was looking in I can thought of creating a global transition, because the value of the field A can be changed to yes at any time in the workflow so creating a global transition is the better way that I thought please share me your ideas on this.

Also please help me on what validator or condition would be the best that can be used to achieve my task

thanks in advace

Comments (5)

  1. Fidel Castro Armario repo owner

    Hi Bharath,

    Your question is identical to issue #357. I copy + paste the solution with minor adaptations:

    The solution I can provide you requires to remove fields A and B from edit screen, and force them to be edited using a reflexive transition that presents the user the field to be edited (for example creating a transition called "Edit A and B").

    The solution in detail is:

    1) Create a global reflexive transition called "Edit A and B". A global transition is available from any status, and a reflexive transition has the same origin and destination status. The following screenshot shows how to create these kind of transitions.

    2) Remove A and B custom fields from EDIT screen, so that nobody will be able to edit them directly. You should keep those fields in VIEW and CREATE screens. If you are using the same screen for EDIT and VIEW operations, or for EDIT and CREATE operations, you will have to clone the screen and use different screens for each operation.

    3) Create a new screen called "Edit A and B Screen", add fields A and B to it, and associate the screen to "Edit A and B" transition.

    4) Add "Boolean validator with math, date-time or text-string terms" to "Edit A and B" transition with the following boolean expression:

    %{aaaaa} = "Yes" IMPLIES %{bbbbb} != null
    

    replacing aaaaa with field code for A custom field, and bbbbb with field code for B.

    You should write the literal string "Yes" in the boolean expression respecting the case, exactly identical to the name of the option in A field.

  2. Bharath Kumar reporter

    I tried this and when I select the yes in the transition screen, even if I dont fill any value in the field B i am able to pass through the transition.

    The system should not let the user go out of the transition when ever yes is selected. It should ask the user to fill some value in field B since it will be a mandatory field once field A is changed to yes.

    one more thing is is there a way to do this without have a transition thing I mean can we do the same thing like when ever I just change the field a value to YES the the system should say that Field B is required

  3. Fidel Castro Armario repo owner

    Sorry, my description of the solution had some mistakes. I have edited my post and corrected it. Please, re-read it and correct your implementation.

    In my description I have chosen the name "Edit fields A and B" for the reflexive transition. Obviously you will be able to chose a more suitable name for it.

    Sorry, but the only solution I can provide uses a reflexive transition. I don't know any other one.

  4. Bharath Kumar reporter

    Thanks for the solution Fidel, I will try this one out and let you know if that is meeting requirement. :)

  5. Log in to comment