Properly show the label form field's selection if it has a value upon load
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 30 Jul 2021 08:27:05 +0000 (10:27 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 30 Jul 2021 12:35:58 +0000 (14:35 +0200)
This got broken during the TypeScript migration, because the constructor's
`labelId` parameter is typed as string, but in reality it was passed an
integer. This broke a `===` comparison with the `data-label-id` property of the
list items, thus failing to properly select the label.

com.woltlab.wcf/templates/__labelFormField.tpl
wcfsetup/install/files/acp/templates/__labelFormField.tpl

index a3ca75b729cf5359c43f1e36e46b9fa6ba0de937..a0e66448b0b52a0c4b4920ba29a02939c83c1766 100644 (file)
@@ -32,7 +32,7 @@
                
                new FormBuilderFieldLabel(
                        '{@$field->getPrefixedId()}',
-                       {if $field->getValue()}{@$field->getValue()}{else}null{/if},
+                       {if $field->getValue()}'{$field->getValue()|encodeJS}'{else}null{/if},
                        {
                                forceSelection: {if $field->getLabelGroup()->forceSelection}true{else}false{/if}
                        }
index a3ca75b729cf5359c43f1e36e46b9fa6ba0de937..a0e66448b0b52a0c4b4920ba29a02939c83c1766 100644 (file)
@@ -32,7 +32,7 @@
                
                new FormBuilderFieldLabel(
                        '{@$field->getPrefixedId()}',
-                       {if $field->getValue()}{@$field->getValue()}{else}null{/if},
+                       {if $field->getValue()}'{$field->getValue()|encodeJS}'{else}null{/if},
                        {
                                forceSelection: {if $field->getLabelGroup()->forceSelection}true{else}false{/if}
                        }