NasExt / DependentSelectBox

DependentSelectBox control for Nette Framework
MIT License
22 stars 26 forks source link

SetDisabledWhenEmpty doesn't work when required #4

Closed Ejdems666 closed 7 years ago

Ejdems666 commented 8 years ago

Hi,

I have a dependent selectbox that is required and is also disabled when empty, which works just fine. But When I submit the form when this particular selectbox is empty (thus also disabled) I get an error that the field is required.

Maybe I'm doing something wrong, I'm still a noob in Nette, but in my opinion the required option should be ignored when the field is disabled.

Would you know how to fix this? Or could you suggest alternative approach?

the code: $form->addDependentSelectBox('organ_id', 'Orgán', array($form['model_id'],$form['state_id']), [$this,'handleStateChange']) ->setPrompt('Select from model') ->setRequired('vyberte') ->setDisabledWhenEmpty(true);

Btw. I'm ussing onSuccess callback on the form.

Thanks for your time in advance. Adam

duskohu commented 8 years ago

Hi @Ejdems666 can you send error message?

Ejdems666 commented 8 years ago

Well I get the standard nette form error that the certain input is required and should be filled.

What I'm asking is, if it's possible to have a dependent selectbox set as required, but only if it contains some items.

aleswita commented 7 years ago

@Ejdems666 can you check this issue in 3.1.0 version?