winter icon indicating copy to clipboard operation
winter copied to clipboard

[fix] preview collapsed repeater titleFrom

Open AIC-BV opened this issue 1 year ago • 0 comments

Cleaned up version of the preview HTML:

<div class="text-field" data-field-name="name">
    <label>Name</label>
    <span class="form-control">Test</span>
</div>

As you can see, there is no element to select with class text-field if titleFrom is set, because the target itself has the class:

var $disabledTextInput = $('.text-field:first > .form-control', $target)

so I removed the .text-field part of the query selector

Now it succesfuly shows the text value from name in both preview and update context. If titleFrom is not set, it will take the first .form-control value, which is the same field as in update context image Before this change, it showed nothing, because the selector was invalid image

fields.yaml:

items:
    context: ['preview', 'update', 'relation']
    tab: Content
    label: aic.aftersales::lang.form.items.title
    titleFrom: name
    type: repeater
    style: collapsed
    dependsOn: order
    form:
        fields:
            name:
                label: aic.aftersales::lang.form.items.name
            requires_payment:
                label: aic.aftersales::lang.form.items.requires_payment
                type: balloon-selector
                options:
                    0: Nee
                    1: Ja
                default: 0

AIC-BV avatar Aug 26 '24 07:08 AIC-BV