Skip to content
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

FIX Ensure tab is highlighted for validation error #1751

Conversation

GuySartorelli
Copy link
Member

@@ -18,6 +18,7 @@ class FormMessageBootstrapExtension extends Extension
'good' => 'alert-success',
'bad' => 'alert-danger',
'required' => 'alert-danger',
'validation' => 'alert-danger validation',
Copy link
Member Author

Choose a reason for hiding this comment

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

  • Keeping validation for projects that might be using that css class as a selector for changed styling or for js logic.
  • Need alert-danger for detecting the error in
    const $invalidTabPanes = this.find('.tab-pane .alert-danger, .tab-pane .alert.error').closest('.tab-pane');
    if (!$invalidTabPanes.length) {
    // If we are at this point it's probably a failed DataObject::validate()
    // where there was a general (non-field) error added via ValidationResult::addError()
    return;
    }

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Tested locally, works well

Have merged silverstripe/silverstripe-frameworktest#180 - good to merge when CI has gone green

@emteknetnz emteknetnz merged commit 8dc91bd into silverstripe:2 May 22, 2024
12 checks passed
@emteknetnz emteknetnz deleted the pulls/2.2/tab-highlight-with-field-error branch May 22, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants