From: Tim Düsterhus Date: Fri, 30 Jul 2021 08:27:05 +0000 (+0200) Subject: Properly show the label form field's selection if it has a value upon load X-Git-Tag: 5.4.3~37^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=766234f6f85dac0e4f4350efa9bb8948bca19c79;p=GitHub%2FWoltLab%2FWCF.git Properly show the label form field's selection if it has a value upon load 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. --- diff --git a/com.woltlab.wcf/templates/__labelFormField.tpl b/com.woltlab.wcf/templates/__labelFormField.tpl index a3ca75b729..a0e66448b0 100644 --- a/com.woltlab.wcf/templates/__labelFormField.tpl +++ b/com.woltlab.wcf/templates/__labelFormField.tpl @@ -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} } diff --git a/wcfsetup/install/files/acp/templates/__labelFormField.tpl b/wcfsetup/install/files/acp/templates/__labelFormField.tpl index a3ca75b729..a0e66448b0 100644 --- a/wcfsetup/install/files/acp/templates/__labelFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__labelFormField.tpl @@ -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} }