!lost - So I added a new radio field with the n...
# ❓questions
u
So I added a new radio field with the name background to my pagescontroller getForm()
Copy code
php
            Radios::make()
                ->name('background')
                ->label('Hintergrund')
                ->inline()
                ->required()
                ->options(
                    Options::make([
                        Option::make('#2B2E34', 'Primär'),
                        Option::make('#C7BAAC', 'Sekundär'),
                        Option::make('#1D1D1B', 'Tertiär'),
                    ])
                )
        );
the migration has
Copy code
php
$table->string('background', 10)->nullable();
however the field is always null even if i change it?
am i missing something?
i
Is background in your model's fillable?
u
awwwww damn it
yeahh..... thanks lol
i just updated the option values but they are still filling the old one
any way to update them without deleting the old page?
i
not sure what you mean exactly. If you remove a value from the options that is still in use in a db row it wouldn't remove itself, you would need to write a migration or seeder to update the old value to the new value.
u
I have not removed the option but changed the value of it
And that value is not updating anymore
i
sorry if I'm missing something but I don't get it. Say you have 3 options, A, B and C. You save with A selected. Then you change A to Z in your code. The database still has A, but no corresponding option in the code. When you try to select Z, it doesn't let you save?
u
before
Copy code
php
Options::make([
  Option::make('#2B2E34', 'Primär'),
  Option::make('#C7BAAC', 'Sekundär'),
  Option::make('#1D1D1B', 'Tertiär'),
])
after
Copy code
php
Options::make([
  Option::make('new-value-1', 'Primär'),
  Option::make('#C7BAAC', 'Sekundär'),
  Option::make('#1D1D1B', 'Tertiär'),
])
i understood the later value of an option is the key, the first is the value
i only changed the value, which shouldnt have an effect on a db level no?
and yea, once i saved with values from before, it would no longer update with values from after if i save it with any other option
does that make it more clear? sorry if i fail to explain it properly :D
i
the label wouldn't have an effect at the db level but the value would. is the order of arguments what is confusing both of us right now? haha. fwiw, just merged this PR: https://github.com/area17/twill/pull/2231/files, though you're not using fromArray
u
> is the order of arguments what is confusing both of us right now? not quite, as i never changed the label (second param) only the value, first param