I want to create a confirmation with a checkbox. Unfortunately, we are having an issue where no matter what we do when we click cancel, the checkbox still checks.
We can prevent it initially but can't get it after.
We are using Informed for our Forms & react-confirm-alert for our notification package.
I have attached a sandbox https://codesandbox.io/s/hardcore-sara-j34x8?fontsize=14&hidenavigation=1&theme=dark
`
const Bear = () => {
confirmAlert({
title: 'Confirm to submit',
message: 'Are you sure to do this.',
willUnmount: () => {
},
buttons: [
{
label: 'Yes',
onClick: (e) => {
// console.log('True');
// return true;
},
},
{
label: 'No',
onClick: (e) => {
return false;
console.log('false');
},
},
],
});
};`
<label className="saAdminCheckBoxLabel">
<Checkbox
onClick={(e) => {
e.preventDefault();
Bear();
}}
field="arecNeutral"
/>
<span>Neutral USE THIS ONE</span>
</label>
Aucun commentaire:
Enregistrer un commentaire