0

I have a form that includes many checkboxes with the same name but with different values, when the form is submitted I get a single variable that has the name of the checkboxes and it contains a comma separated list values of each checkbox that was checked. All this is OK, however, I have modified the form to disable some of the checked checkboxes which means that we cannot uncheck the checkbox, again this is OK and working. The issue that I have is that disabled checked checkboxes do not have a value when submitted.

Is there another property I can use that will include all checked checkboxes?

user229044
  • 232,980
  • 40
  • 330
  • 338
Peter
  • 83
  • 9

1 Answers1

1

There is not another property that you can use. readonly can be used for fields where the value is what changes. However, for checkboxes, the value doesn't change so it cannot be used.

The best you can do is to leave the checkboxes disabled and add hidden input fields to get the values you need onto the server.

Ruan Mendes
  • 90,375
  • 31
  • 153
  • 217
  • Thanks for your answer, however, I can create a fix I was wondering if there's another property I could use. – Peter Dec 14 '16 at 22:33
  • It is the answer to the question. There is no other property to set that will do what you want with a checkbox ;) – Ruan Mendes Dec 15 '16 at 04:49
  • I agree, it is the answer. I keep track of disabled checked checkboxes in a hidden field and then add these to the list of enabled checked checkboxes. Thanks. – Peter Dec 15 '16 at 17:02