How to update using checked boxes

My response is nothing to do with check boxes and more to do with the amount of errors showing in your page. That’s a lot of errors Parker! Simply an observation on my part…

Ah, maybe set a value on dynamic attributes ‘Checked’ … you probably don’t need the dmx-bind:value any longer after adding the checked attribute. Been awhile since I used check boxes.

And as Cheese pointed out, you have a ton of code errors on the page. Most likely duplicate IDs.

what do these duplicate ID’s mean and how will it affect me going forward

It’s invalid code. IDs must be unique. You will want to fix them. Clicking on the red X at the bottom left corner of your code view will tell you exactly what the errors are.

Screenshot 2023-11-09 at 3.30.08 PM

1 Like

so because all my inserts are inp_myid it’s flagging that. I’m confused as to how this is invalid code but it still operates on the desktop. What about it makes it makes it an error (sorry if a dumb question, I’m brand new to website development)

In HTML, the ID attribute is used to uniquely identify an element within a document. The main reason IDs need to be unique is to ensure that the document’s structure is well-defined and that different parts of the document can be easily distinguished and manipulated. When each element has a unique identifier, it becomes much easier for developers to reference specific elements using scripts, stylesheets, or other programming languages.

Here are a few reasons why IDs need to be unique in HTML:

  1. Scripting and styling: Unique IDs allow developers to easily manipulate specific elements using JavaScript or CSS. By selecting elements based on their unique IDs, developers can apply specific styles or execute particular functions for a specific element.

  2. Document structure: Unique IDs help in creating a clear and unambiguous document structure. When IDs are unique, it becomes easier for developers and web browsers to understand the relationships between different elements within the document.

  3. Accessibility: Unique IDs aid in creating accessible web content. They enable assistive technologies, such as screen readers, to navigate the document more efficiently, improving the overall accessibility and user experience.

  4. Linking and navigation: Unique IDs can be used as anchors within a document, allowing users to navigate to specific sections of a page quickly. When IDs are unique, it becomes straightforward to link to specific parts of a document using anchor tags.

Failure to maintain unique IDs can lead to unexpected behavior and may cause issues in rendering the web page correctly. For instance, if multiple elements have the same ID, it can lead to conflicts when trying to manipulate those elements using scripts or stylesheets. Therefore, it is a best practice to ensure that IDs are unique within the HTML document.

2 Likes

will changing these ID’s change my code to make it not function properly?

Quite the opposite. Changing them will improve your chances of your code working as you intend it to, and give you a clean slate to build upon avoiding confliction in the future. It is worth keeping an eye on any errors being highlighted by Wappler as there is the possibility they could be causing issues with your application in multiple ways. Best to clear them up and investigate as they arise as they can soon mount up. Sorry to have highlighted this issue in the middle of your thread. Did not intend to inconvenience you.

1 Like

Have a look at:

2 Likes

No not a problem at all! Looking for any guidance I can get, thank you

1 Like

I’m still having issues with displaying the checked boxes, but everything else displays perfectly using the data detail as the container. Any pointers that could help me out and make it so my checked boxes also update?

Did you try adding the checked dynamic attribute? Please show your code for your checkbox.

image

You don’t have an expression in your dmx-bind:checked attribute.

sorry! I swear I tried that but of course it works right away! Thanks a ton

2 Likes

Yay! Success. Always feels good when something works! :beers:

For future reference when sharing code it’s best to paste your code in your post rather than screenshots. Screenshots can be hard to view on mobile devices. It’s also easier for someone to provide you with the proper code without having to retype it all.

Good luck!

2 Likes

It just broke, this is the error message it’s giving me now. I didn’t change anything. It’s still default(0) for the add and update API’s.

It won’t let me submit or update when the box is empty. My database allows for ENUM(0,1)

In my database I switched it from ENUM to something else, and now it works. Very weird, could possibly be a bug

also for my update theme, even if every checkbox is empty it still pops up with every box checked.

Currently I have default(0) for my updates, a static value of 1, and a dynamic attribute > checked box > datadetail > for that data field. It returns every box checked everytime. Plus I’m not sure what happened with my first IS_Rule box because it won’t even accept 0 as a value i guess.