Make a field mandatory based on other field

Issue #422 closed
Bharath Kumar created an issue

I have a drop down field with values "Yes" and "No", now when I select "Yes" that should make one of the field mandatory how can I achieve that.

below is the screenshot of the screen that I am taking about

commited.jpg

In the screenshot when ever I select the "Yes" for the field Development Commitment then the PMUWS ID should be mandatory ( which means I should not be able to execute the transition without entering a value for the PMUWS ID field when I select yes) and also when I select "No" even if I dont enter a value in the PMUWS ID field I should be able to execute the transition.

I wish we could show a error message when ever I select "Yes" and dont enter a value in the PMUWS ID field and try to execute the transition.

Comments (11)

  1. Bharath Kumar reporter

    I tried this and this validation is not working Fidel, when I select Yes and hit the transition button without entering a value in the ID field there is no warning message shown

    below id the screen shot of the validator that I used

    commited 1.jpg

  2. Fidel Castro Armario repo owner

    Which field types are "Development Commitment" and "PMUWS ID"?

    Let's do some debugging. Please, insert temporarily "Copy a parsed text to a field" post-function with the following configuration:

    • Target field: New comment
    • Text to be parsed:
    Development Commitment: "%{aaaaa}"
    PMUWS ID: "%{bbbbb}"
    

    replacing aaaaa with field code of "Development Commitment", and bbbbb with field code of "PMUWS ID".

    Now, when you execute the transition, a new comment will be automatically created with the actual values of the fields.

  3. Bharath Kumar reporter

    Ya this is the output of the comments I did select all the combinations

    commited 2.jpg

    the field Development Commitment is a single select field and PMUWS ID field is a text field

  4. Fidel Castro Armario repo owner

    "Development Commitment" is not an ordinary Select List custom field. Can you please check the exact type of custom field? Maybe provided by a plugin.

  5. Bharath Kumar reporter

    It is a select list field and blow is the screen shot of the same

    commited 3.jpg

    The other text that appears in the comment is because I made some changes to the field to change the color and look of the field thats it nothing other than that

    here is the ss of the same

    commited 4.jpg

  6. Fidel Castro Armario repo owner

    Use this boolean expression instead the current one:

    %{aaaaa} ~ "Yes" IMPLIES %{bbbbb} != null
    
  7. Bharath Kumar reporter

    That worked Fidel, thanks for the quick response really happy that you responded real quick :+1:

  8. Log in to comment