Skip to content

"required_if" validation rule does not work with native "published" field #790

@dadaxr

Description

@dadaxr

Description

I have a use case where some entries must be partially filled by a given X person, but then published by another Y person.

The X person does not have all the information (ie data) to fill all the required fields needed for publishing.

So I tried to make some fields "required" only when trying to "publish" the entry.

Image

but ... this does not work : the rule is not applied and the field is never "required".

However, this work well on classic statamic collections. So it's related to runway.

My guess was "it's because "published" is not a "user defined" field.

I found a workaround :
add a "published" hidden field in the collection blueprint, and then it works !

Steps to reproduce

create a "publishable" runway resource,

add a blueprint for it, with a "test" (text) field having a "required_if:published,true" validation rule,

try to publish ... the validation rule is ignored.

Environment

Environment
Laravel Version: 12.55.1
PHP Version: 8.4.13
Composer Version: 2.8.12
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: fr

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

Drivers
Broadcasting: log
Cache: file
Database: mariadb
Logs: stack / daily
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.7.1 PRO

Statamic Addons
jacksleight/statamic-bard-texstyle: 4.0.0
statamic-rad-pack/runway: 9.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions