This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

aleXela
aleXela

Hey, I found this topic from the past. https://octobercms.com/forum/post/dropdown-shows-its-value-than-key-name-in-list-controller

If I use only : public function getCategoryOptions(){ return [ 1=> 'CNC machining', 2=> '3D print', 3=> 'Laser cutting', 4=> 'Injection molding', 5=> 'Bending', 6=> 'Design', 7=> 'PCB design', 8=> 'Welding', 9=> 'Optics' ]; }

I see in a new/update model (form) the list and right saved option.

But in the list of models (manufacturers) i see only the number (lets say 2(saved option))

If I use: public function getCategoryAttribute($cat){ $value = array_get($this->attributes,'category'); return array_get($this->getCategoryOptions(), $value); } this transformation, in the list I see right choice "3D print", but in edit mode it shows first option. In DB right option is stored. Didnt find solution for this.

Please advice. Thanks

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.