With Alpine.js conditional fields
Statamic includes a helper for conditional fields that simply works, and is written with Alpine.js. The Variable Number fieldtype works harmoniously with Statamic's conditional fields.
Depending on your use case, you may need to scope your Statamic form data to prevent conflicts.
For unscoped data
There's nothing extra to do. You're all set!
For scoped data
In the wrapper div
for each layout, you will see a data-target-container
attribute:
1<div x-data="variableNumberFieldtype" ... data-target-container="" ...>
This should be updated to be the container used with your scoping.
Following the Statamic docs, their scoping shows a js="alpine:contact_form"
example. The container here is contact_form
.
Update the data-target-container attribute to have this value.
1<div x-data="variableNumberFieldtype" ... data-target-container="contact_form" ...>