eeditiones / tei-publisher-components

Web components used by TEI Publisher and apps generated by it
https://cdn.tei-publisher.com/
GNU General Public License v3.0
18 stars 14 forks source link

pb-select in pb-repeat templates #29

Open tuurma opened 4 years ago

tuurma commented 4 years ago

Extending pb-search with pb-repeat/pb-select leads to incorrect query parameter set when serializing the default first instance of the pb-repeat

Setting <pb-repeat initial=0> works well, thus the problem lies probably in initializing pb-repeat/template

image

image

<pb-search id="search-form" subscribe="search"
                                    data-template="pages:parse-params" value="${query}" submit-on-load="submit-on-load">
      <pb-repeat> 
            <template>
                  <pb-select name="bar" label="bar" source="modules/autocomplete.xql?query=k"/>
            </template>
     </pb-repeat>                                    
</pb-search>
daliboris commented 1 year ago

I found the solution for this issue:

const name = (input.name === undefined) ? ${input.attributes.getNamedItem("name").nodeValue}[${idx}] : ${input.name}[${idx}];

Name of the element can be reached as the attribute value if the name property is undefined.

I'll prepare pull request.