Forum
Checkbox default attribute bug?
Hi there,
It seems that setting the default
attribute of a checkbox to 1
makes it forever stay checked, rather than just as a default. After unchecking it, it simply becomes checked again upon saving the region. I noticed this a couple of years ago using Perch, problem still seems to be there. Can you replicate this?
Thanks,
Alex
Can we see your template?
It's quite a complex issue. In HTML, when a checkbox has no value the field simply doesn't exist in the data that is sent from the form. There is therefore no difference between an unchecked checkbox and a checkbox which hasn't been checked yet.
I've just run into this - is there any way for Perch to ignore the default coded in the template if the region has just been edited, as opposed to just created? Maybe querying whether there's an undo level available?
That way when you first enter something into a brand-new region, your checkbox defaults would kick in and show the ticks. But if you were editing an already-populated region, the defaults would be ignored and your choice of having a given checkbox be un-ticked could be shown in the UI.
No idea if Perch's guts could allow for that, but what do you reckon?
I had the same issue with the following code
Changing it to
seems to have helped