Hello,
in a repeater, I have a select field.
When I indicate ‘val’ in value_method of the “item_label”, the value of selected option is writing correctly. But I want it’s write the text of selected option.
So for this I indicate ‘text’ in value_method but when I do this I have text of all option that its’ write.
Could you help me please ?
Thanks
$form['brands'] = [ 'type' => 'repeater', 'label' => __( 'Brands' , $this->domainTrad ), 'item_name' => __( 'Brand', $this->domainTrad ), 'item_label' => [ 'selector' => "[id*='brand']", 'update_event' => 'change', 'value_method' => 'text' ], 'fields' => [ 'brand' => [ 'type' => 'select', 'label' => 'Choose a Brand', 'options' => [ '1' => 'test 1', '2' => 'test 2', '3' => 'test 3', '4' => 'test 4', ] ] ] ];
Hi Michael,
Thanks for getting in touch. You can return the value by specifically targeting the selected option. Change:
To:
Kind regards,
Alex
Top, it’s work
Thank’s Alex
Hi Michael,
It’s great to hear that helped! :)
Please feel free to open a new thread if anything else comes up.
Kind regards,
Alex