Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping template issues with delimiter and allows value #71

Open
krabina opened this issue Nov 10, 2024 · 7 comments
Open

Mapping template issues with delimiter and allows value #71

krabina opened this issue Nov 10, 2024 · 7 comments

Comments

@krabina
Copy link

krabina commented Nov 10, 2024

The mapping template feature works if you set values directly in the form definition:
|vallues=a,b,c|mapping template=foo
If the values should come from allowed values of a property and you set
|property=bar|mapping template=foo
then it does not work.

@krabina
Copy link
Author

krabina commented Nov 10, 2024

allowed values are shown from the property, but they are not mapped using the template

@gesinn-it-gea
Copy link

gesinn-it-gea commented Nov 10, 2024

Can you please share the complete field definitions to be sure we don't miss something. Did you have a chance to test this with a current upstream version of PF?

@krabina
Copy link
Author

krabina commented Nov 10, 2024

{{{field|Kategorienschema|input type=tokens|delimiter=;|values=AGRI;ECON;EDUC;ENER;ENVI;GOVE;HEAL;INTR;JUST;REGI;SOCI;TECH;TRAN;|mapping template=MappingKategorien|class=form-control}}}

Template:MappingKategorien:
{{#switch: {{{1}}} |AGRI=Landwirtschaft, Fischerei, Forstwirtschaft und Nahrungsmittel |ECON=Wirtschaft und Finanzen |EDUC=Bildung, Kultur und Sport |ENER=Energie |ENVI=Umwelt |GOVE=Regierung und öffentlicher Sektor |HEAL=Gesundheit |INTR=Internationale Themen |JUST=Justiz, Rechtssystem und öffentliche Sicherheit |REGI=Regionen und Städte |SOCI=Bevölkerung und Gesellschaft |TECH=Wissenschaft und Technologie |TRAN=Verkehr | }}

@krabina
Copy link
Author

krabina commented Nov 10, 2024

it seems that in the current master the problem is gone.

@krabina krabina closed this as completed Nov 10, 2024
@krabina krabina reopened this Nov 10, 2024
@krabina
Copy link
Author

krabina commented Nov 10, 2024

No. Problem is still there.

@krabina
Copy link
Author

krabina commented Nov 10, 2024

A second issue with mapping template is the following:
If you only select one value, it works: when you enter the form for the page again, it will display the mapped value in the form.

As soon as you select a second value, on the next form edit, the field values are shown, not the mapped values.

@krabina
Copy link
Author

krabina commented Nov 10, 2024

The second problem goes away if you don't sepcify a delimiter. This field definition works while the above does not.
{{{field|Kategorienschema|input type=tokens|values=AGRI,ECON,EDUC,ENER,ENVI,GOVE,HEAL,INTR,JUST,REGI,SOCI,TECH,TRAN|mapping template=MappingKategorien|class=form-control}}}

@krabina krabina changed the title Mapping template don't work when values come from properties Mapping template issues with delimiter and allows value Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants