-
-
Notifications
You must be signed in to change notification settings - Fork 549
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
Frontend form field conditions ... #4949
Conversation
…dynamic fields loop.
…ay (other fields WIP).
…ontend-form-conditions
…ontend-form-conditions
…so we want to unzip to `resources`.
…core's `chainable` mixin.
…rule with form conditions.
…ontend form fields with `sometimes` rule.
@jasonvarga This is done and ready for review, but I made draft because #5101 should be reviewed and merged into this first 👍 |
…required_if`, etc. rules (#5101)
…/frontend-form-conditions
…/frontend-form-conditions
# Conflicts: # src/Fields/Field.php
Hey Jesse. I'm trying this one out as it looks great. Currently I already have my own x-data on the form tag. Do you have any thoughts on how you can combine your own Alpine logic with this one? |
Simply moving my own logic a level up gets me further. 👍 |
@robdekort Yes exactly. If you had your x-data on the |
Sounds good. Will dive in further today. Thanks!! |
For now we'll be shipping with an
alpine
driver, but this can be expanded later.Example usage:
Include frontend JS:
Render form using dynamic fields array:
Render form with hardcoded fields:
Todo:
helpers.js
dist file with separate webpack config.x-data
on form whenjs="alpine"
is present.old
input when there are validation errors.js="alpine:my_form"
to prevent collision with their alpine components.x-model
on dynamically rendered fields (will need to be done manually if hardcoding fields).Statamic.$conditions.showField()
JS logic.Alpine
driver class.Statamic.$conditions.showField()
JS logicsometimes
rule for conditionally applying validation to fields (see Conditionally hidden fields still submit values, preventing use ofsometimes
,required_if
, etc. rules #5092).Closes #5092
Closes statamic/ideas#714