Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Save checkboxes value in data

$
0
0

I have the following code for rendering my checkboxes:

  <ion-list-header>
        <ion-label>Reason</ion-label>
    </ion-list-header>
    <ion-item v-for="entry in form" :key="entry.val">
        <ion-label class="ion-text-wrap">{{ entry.text }}</ion-label>
        <ion-checkbox
            slot="end"
            v-model="entry.isChecked"
            @update:modelValue="entry.isChecked = $event"
            :modelValue="entry.isChecked">
        >
        </ion-checkbox>
    </ion-item>
</ion-list>

Now I have in the data a form object which fills the checkboxes, and also a empty array where I want the values to be stored:

    return {
    
        settings: {
            checkboxes: [],
        },
        form: [
            { val: "valone", text:"Text 1", isChecked: false },
            { val: "valtwo", text:"Text 2", isChecked: false },
            { val: "valthree", text:"Text 3", isChecked: false },
            { val: "valfour", text:"Text 3", isChecked: false },
            { val: "valfive", text:"Text 3", isChecked: false },
        ]
    };

But I don’t know how to get the values of the checked checkboxes to the data array. Maybe I should not save in the array. Anyone know how to save these values?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles