Jump to content

Checkbox value not persisting on page save, value is always 0 [SOLVED]


FireWire
 Share

Recommended Posts

Like the title says. I've added a checkbox field to the User template, checking it and clicking save on the page doesn't store the value and the checkbox is always unchecked when the page loads.

I'm creating a hook that works with this template and checkbox value for addHookBefore Pages::save. Accessing the value is always 0. Setting the checkbox value inside the hook doesn't save either. Inserting values into other fields in the same hook does save. I'm using $page->checkbox_field_name to access the value, and $page->checkbox_field_name = true when testing to try setting the value via API.

More info:

  • I'm editing this user profile under the Superuser role which shouldn't present any permission issues.
  • I've enabled the checkbox under "What fields can a user edit in their own profile?", but shouldn't matter because I'm editing another user's profile.
  • Checkbox value fails to save whether hook is present or not.
  • PW v3.0.184

halp.

Edited by FireWire
Solved issue.
Link to comment
Share on other sites

Solved the issue. Found the following issue in a post from 2015 using some Google search that described a similar/same problem.

I was able to solve the issue by logging in as a different user, checking the checkbox, and then saving the page. After that the superuser role was then allowed to set/save the checkbox.

Odd issue. I created two fields, one text and one checkbox. I was able to set the value of the text as a superuser but not the checkbox.

Solution is to log in as a different user with access to this field, set a value, then logout and then login as the superuser which will then allow the value to be saved.

  • Like 1
Link to comment
Share on other sites

  • FireWire changed the title to Checkbox value not persisting on page save, value is always 0 [SOLVED]

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...