Skip to content

Fix selectBox prompt + required + checkDefaultValue = False - #343

Merged
dg merged 1 commit into
nette:masterfrom
bartko-s:fix-select-box
Mar 31, 2025
Merged

Fix selectBox prompt + required + checkDefaultValue = False#343
dg merged 1 commit into
nette:masterfrom
bartko-s:fix-select-box

Conversation

@bartko-s

Copy link
Copy Markdown
Contributor
  • bug fix
  • BC break? no

Example code:

$form->addSelect('country', 'Country', ['sk' => 'Slovakia', 'cz' => 'Czech Republic'])
    ->setRequired()	
    ->checkDefaultValue(false)
    ->setPrompt('-- select value --')
    ->setDefaultValue('en'); // value does not exists

The expected behavior is that the prompt will be selected but the first item is selected.
In version <= 3.2.1 this worked correctly.

@dg

dg commented Mar 31, 2025

Copy link
Copy Markdown
Member

Thanks

@dg
dg merged commit d4dc7e8 into nette:master Mar 31, 2025
dg pushed a commit that referenced this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants