value_method on repeater
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',
]
]
]
];This is our free support forum. Replies can take several days.
Need fast email support? Get SiteOrigin Premium
Replies
3Hi 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
Replies on this thread are closed.
Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.