diff --git a/src/runtime/components/forms/RadioGroup.vue b/src/runtime/components/forms/RadioGroup.vue index 1d334b49fc..f49675f8b0 100644 --- a/src/runtime/components/forms/RadioGroup.vue +++ b/src/runtime/components/forms/RadioGroup.vue @@ -104,7 +104,7 @@ export default defineComponent({ const { ui, attrs } = useUI('radioGroup', toRef(props, 'ui'), config, toRef(props, 'class')) const { ui: uiRadio } = useUI('radio', toRef(props, 'uiRadio'), configRadio) - const { emitFormChange, color, name } = useFormGroup(props, config) + const { emitFormChange, color, name } = useFormGroup(props, config, false) provide('radio-group', { color, name }) const onUpdate = (value: any) => { diff --git a/src/runtime/composables/useFormGroup.ts b/src/runtime/composables/useFormGroup.ts index 508fa9128f..5d3732de2f 100644 --- a/src/runtime/composables/useFormGroup.ts +++ b/src/runtime/composables/useFormGroup.ts @@ -12,13 +12,15 @@ type InputProps = { } -export const useFormGroup = (inputProps?: InputProps, config?: any) => { +export const useFormGroup = (inputProps?: InputProps, config?: any, bind: boolean = true) => { const formBus = inject | undefined>('form-events', undefined) const formGroup = inject('form-group', undefined) const formInputs = inject('form-inputs', undefined) if (formGroup) { - if (inputProps?.id) { + if (!bind || inputProps.legend) { + formGroup.inputId.value = undefined + } else if (inputProps?.id) { // Updates for="..." attribute on label if inputProps.id is provided formGroup.inputId.value = inputProps?.id }