Data exists in table? Checkbox Problem

Hans Hartmann wrote: [...]

Question: How can I check if a box was clicked last time(value saved in the table)

Look at the appropriate field in the database. If you use form_for, it does that for free.

into the blue: if "value" exists in "table" document.getElementById("checkbox1").checked = true if "value" doesn't exist in "table" document.getElementById("checkbox1").checked = false

Why on earth would you do this in client-side JavaScript instead of on the server side? That doesn't appear to make sense.

Thx for your answers

Best,

Hans Hartmann wrote:

I tried and tried and tried

And what did you try?

... but everything in my checkbox is deleted after refreshing the page (instead of the values in my database) so how can I ask for them.

The behavior of unsubmitted forms in the browser on page refresh is somewhat browser-dependent, but most browsers will reset them. This is what users expect.

Why do you need this functionality, anyway? If you explain what you're trying to achieve by doing this, perhaps we can be of more help.

Thx till now...

Best,