How to use Conditional Fields in Controller
I want to add a Author select fields when shared_by === user
$form->add(
Radios::make()
->name('shared_by')
->label('Author')
->border()
->options(
Options::make([
Option::make('anonymous', 'Anonymous'),
Option::make('bot', 'Bot'),
Option::make('user', 'User'),
])
)
);
2 Replies
You need Twill 3.1 for conditional fields in the form builder.
On your author field, use
->connectedTo('shared_by', 'user')
thank you, will try
I try it on a input
Call to undefined method A17\Twill\Services\Forms\Fields\Input::connectedTo()
oh wait i have twill 3.0
yes, it works, thank you very much!