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

validate: sometimes not working when used in Nav blueprint #11249

Open
o1y opened this issue Dec 12, 2024 · 2 comments
Open

validate: sometimes not working when used in Nav blueprint #11249

o1y opened this issue Dec 12, 2024 · 2 comments

Comments

@o1y
Copy link
Contributor

o1y commented Dec 12, 2024

Bug description

When using validate: sometimes in a Nav blueprint, validation rules are triggered even when the associated field is not visible.

How to reproduce

Use the following Blueprint for a Navigation:

tabs:
  main:
    display: Main
    sections:
      -
        fields:
          -
            handle: has_image
            field:
              inline_label: 'Show Image'
              inline_label_when_true: 'Hide Image'
              type: toggle
              display: 'Add Image'
          -
            handle: image
            field:
              container: assets
              type: assets
              display: Image
              validate:
                - sometimes
                - required
              if:
                has_image: 'equals true'

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.35.0
PHP Version: 8.3.14
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: statamic-validation-check.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.42.1 Solo

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@duncanmcclean
Copy link
Member

duncanmcclean commented Dec 12, 2024

Have you seen #9334? I think it might be the same issue you're running into here.

@o1y
Copy link
Contributor Author

o1y commented Dec 12, 2024

For some reason, the Navigation Publish Form is always saving the values even if always_save is set to false. This might then cause the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants