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

add SelectOrNew component #869

Closed
wants to merge 4 commits into from
Closed

Conversation

langeuh
Copy link
Contributor

@langeuh langeuh commented May 26, 2017

select from existing values for a certain column or add a new one.
if no options are given, options are filled in automatically using the unique values for the given column. By default the selection can be cleared and an empty value is prepended. You can turn it off by calling allowClear(false) on the field.

e.g.

        $form->selectOrNew('salutation’);

or specify options yourself

        $form->selectOrNew('salutation')
		->options([
			1 => ‘sir’,
			2 => ‘misses’,
		])
               ->rules('required')
               ->allowClear(false);

allowClear
there is method to set wether you can clear the selection or not:

        $form->selectOrNew('salutation’)->allowClear();

inside a nestedForm you’ll need to dataModel() to specify on which model to get the default options from (can't seem to find the related model. Please change it if possible)

$form->selectOrNew('city')
                        ->rules('max:50|string')
                        ->attribute('maxlength', 50)
                        ->dataModel(Address::class);

langeuh and others added 4 commits May 26, 2017 15:34
select form an existing value for a certain column or add a new one
e.g.

        $form->selectOrNew('salutation’);

or specify options yourself

        $form->selectOrNew('salutation’)
		->options([
			1 => ‘sir’,
			2 => ‘misses’,
		]);

inside a nestedForm you’ll need to dataModel() to specify on which model to get the default options from
$form->selectOrNew('city')
                        ->rules('max:50|string')
                        ->attribute('maxlength', 50)
                        ->dataModel(Address::class);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants