Page 1 of 1

How to get checkbox value?

Posted: Thu Apr 25, 2024 3:52 pm
by WABez

I'm using PHPMaker 2024.10. I have a checkbox on a form that I want to use the value to redirect a user to a different page if the checkbox is checked/unchecked.

My dumb question!
Server side:
Server Events > Global > Table Specific > Common > Row_Inserted I used the $this->terminate("mypage"); and it is working fine. Now for the checkbox value, to redirect the user to this page or not.
How can I evaluate whether the checkbox is checked or not?


Re: How to get checkbox value?

Posted: Thu Apr 25, 2024 4:35 pm
by arbei

It depends on how you add the checkbox. Is it one of the fields? In general, you can get it from $_POST["MyCheckboxName"].


Re: How to get checkbox value?

Posted: Thu Apr 25, 2024 5:23 pm
by WABez

Thanks, yes it is one of the fields.

I have tried with:
if (isset($_POST["MyCheckboxName"]))
but no luck.


Re: How to get checkbox value?

Posted: Thu Apr 25, 2024 7:11 pm
by WABez

Solved, error in the code.


Re: How to get checkbox value?

Posted: Thu Apr 25, 2024 7:51 pm
by mobhar

If you are using Row_Inserted server event, then you may try: $rsnew["YourFieldName"] (change YourFieldName to your actual field name).


Re: How to get checkbox value?

Posted: Sat May 25, 2024 5:05 am
by daveb

How do you use this in selection criteria? Current selection shows field_name contains but a value can not be entered?


Re: How to get checkbox value?

Posted: Sat May 25, 2024 11:17 am
by arbei

You need to check if row type is RowType::SEARCH, also see PHP Enumerations.