Hiya,
What I mean is say you have this in a page :
<input type="checkbox" value="Yes" name="field_id_12" id="field_id_12" />
If you were to have the checkbox ticked and submit the form then the Yes value would be sent. That’s all fine but what I want is for if the checkbox isn’t ticked for a different value to get sent with the form instead.
Normally if a checkbox isn’t ticked then no value at all gets sent and so whatever value has already been saved to that field doesn’t get changed at all.
If you imagine that there is a weblog entry where that field has already had its value set to Yes and you want to edit the field to now say No by not ticking the checkbox, that’s what I want to do.
Problem being though that if you don’t tick a checkbox then nothing at all gets sent and so the field doesn’t get written over.
I need this because when you are inputting data the first time then a checkbox is a great way to do this but when you come to editing data then a checkbox isn’t cutting it as there is just no way (at the moment until someone clever in here comes up with the javascript for me 😉 ) to change that data using a checkbox.
Seems weird to me that checkboxes are made in this way, I don’t see why they can’t have two values, one for checked and one for not checked?
Anyway I was thinking that there might be some Javascript which would basically say if this checkbox isn’t ticked then set the value of the checkbox to No but if it is ticked then use the value which is already set in the input parameter which is Yes.
See, clear as mud 😉
Any help on this would be massively appreciated.
Best wishes,
Mark