I have a form in which I have a dropdown which may, or may not, be filled in initially. I have setup the table field to accept NULL entries and the field in question is related to another table for its allowable values.
<?= $form->field(
$model,
'BillingCurrency',
[
'template' => '<div class="col-sm-2">{label}</div><div class="col-sm-2">{input}{error}</div>',
'labelOptions' => [
'class'=>'control-label'
],
]
)->dropDownList(
ArrayHelper::map(
Currencies::find()
->all(),
'BillingCurrency',
'BillingCurrency'
),
[
'prompt'=>'Select ...',
]
)
?>
The issue I’m having is when the form is submitted with no selection being made it errs because the generate update query is try to pass ‘’ as the field’s value rather than NULL. What is the proper way of handling this type of situation?
Thank you in advance for your guidance.