Jump to content

Checkboxes in forms


cb2004
 Share

Recommended Posts

Whats the best way to put checkboxes in a form and sanitize them etc? I found an old forum post but I was just wondering if there are new techniques?

I have been looking at  $sanitizer->options and was just wondering if this is the best way to go.

Cheers.

Link to comment
Share on other sites

Hello @cb2004,

that is an interesting question I asked myself lately. Actually I don't think it is necessary to sanitize the checkbox values, because you are the one who decides which values the checkboxes have and not the user. But you could always sanitize the values, to be sure, that no one tries to manipulate the values with f.e. dev tools in the browser.

Checkboxes could be created with plain HTML or if you want to make use of PW, you could create them via the API:

Regards, Andreas

Link to comment
Share on other sites

On 11/23/2016 at 9:23 PM, AndZyk said:

because you are the one who decides which values the checkboxes have and not the user.

It depends on what you are referring to. If you are referring to what is actually stored in the db, then you are right, but if you are talking about what is being sent to the server, than your statement it is not quite true, since hacking is all about changing the latter. On the other hand, I agree that in the case of checkboxes it is more about validation than sanitization, just like explained in the comments of the accepted answer here:

http://stackoverflow.com/questions/26327953/sanitize-a-value-from-select-radio-checkbox

Edited by szabesz
typo
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...