Quantcast
Channel: Threads Archive - SiteOrigin
Viewing all articles
Browse latest Browse all 338

value_method on repeater

$
0
0

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',
            ]
        ]
    ]
];

The post value_method on repeater appeared first on SiteOrigin.


Viewing all articles
Browse latest Browse all 338