Skip to content

feat(forms): Validation conditions for question answers #19681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ccailly
Copy link
Member

@ccailly ccailly commented May 12, 2025

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.

Description

#19640 must be merged before

Added validation conditions for answers to questions.
Reuse of the condition system already implemented for the visibility of form elements.

Screenshots (if appropriate):

image
image

@ccailly ccailly force-pushed the feature/form-validation-conditions branch from 9fe989f to b32bcc8 Compare May 12, 2025 09:37
@ccailly ccailly force-pushed the feature/form-validation-conditions branch from b32bcc8 to b5779b2 Compare May 12, 2025 12:59
Copy link
Contributor

@AdrienClairembault AdrienClairembault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

For the labels, I would prefer:

  • No validation
  • Valid if...
  • Invalid if...

image

I think in this case we should not display the "Add another criteria" button since it doesn't work.

@ccailly ccailly force-pushed the feature/form-validation-conditions branch from 978ca44 to f738b04 Compare May 13, 2025 14:15
@ccailly ccailly force-pushed the feature/form-validation-conditions branch from f738b04 to 58e1409 Compare May 13, 2025 14:42
@ccailly ccailly self-assigned this May 14, 2025
@ccailly ccailly added the Forms label May 14, 2025
@ccailly ccailly added this to the 11.0.0 milestone May 14, 2025
@ccailly ccailly marked this pull request as ready for review May 14, 2025 07:11
Copy link
Contributor

@AdrienClairembault AdrienClairembault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccailly Could you change the buttons style while it is waiting for validation from the server ?

The icon should be changed to a spinner and the "pointer-events-none" class should be added to prevent interaction (or disabled state).

This would fix #19726.

@trasher trasher requested a review from cedric-anne May 20, 2025 06:47
Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments to mark code lines to update to be compatible with #19762. I will merge the current PR and fix them in #19762.

@cedric-anne cedric-anne merged commit a75f973 into glpi-project:main May 20, 2025
7 checks passed
@ccailly ccailly mentioned this pull request Jun 9, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants