Skip to content

CFormCheck Default Empty Value Problem #300

Open
@bro278911

Description

@bro278911

Hello, I am using CFormCheck and have set the default value to an empty value. However, I am encountering an issue where no actions from CFormCheck seem to have any effect. Additionally, I noticed that when the default value is set to empty, CFormCheck automatically selects the last option. Is this behavior causing the issue?

When using a native input radio, if the default value is empty, none of the options should be selected. Is this not the expected behavior with CFormCheck?

I apologize as I am a beginner and couldn’t find any relevant discussions regarding this issue.

<template>
  <CRow class="mt-3">
      <CCol sm="6">
          <!-- <input type="radio" name="payCondition" value="monthly" v-model="form.payCondition"/>
              <input type="radio" name="payCondition" value="immediate" v-model="form.payCondition"/> -->
          <CFormLabel>Pay Condition</CFormLabel>
          <CFormCheck type="radio" name="payCondition" label="test1" value="monthly" v-model="form.payCondition" />
          <CFormCheck type="radio" name="payCondition" label="test2" value="immediate" v-model="form.payCondition" />
      </CCol>
      <CCol sm="6" v-if="form.payCondition === 'monthly'">
          <CFormLabel>Condition</CFormLabel>
          <CFormInput v-model="form.monthlyTerm" placeholder="testplcae" />
      </CCol>
  </CRow>
</template>
<script setup>
import { reactive} from 'vue';

const form = reactive({
    payCondition: ''
})
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions