Implementation of setOmitted() to Nette\Forms\Rules
fixsoftware opened this issue · comments
Currently, there is no option to use setOmitted() in conditions.
This implementation:
$form->addText('firstname', 'locale.checkout.form.firstname.headline')
->setDefaultValue($this->getDefaultProfileData('billing_firstname'))
->setMaxLength(128)
->addRule($form::MAX_LENGTH, 'locale.checkout.form.firstname.max_length', 128)
->addConditionOn($form['billing_enabled'], $form::FILLED)
->setRequired('locale.checkout.form.firstname.required')
->elseCondition()
->setOmitted() // if section is not enabled, do not save data
->endCondition();
Results in:
Call to undefined method Nette\Forms\Rules::setOmitted().
I don't plan on adding this.