Skip to content

CFormCheck Default Empty Value Problem #300

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

Open
bro278911 opened this issue May 13, 2025 · 0 comments
Open

CFormCheck Default Empty Value Problem #300

bro278911 opened this issue May 13, 2025 · 0 comments

Comments

@bro278911
Copy link

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>
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

1 participant