Jump to content

How does one create a checked checkbox in a Page Array field?


Gabi
 Share

Recommended Posts

Hi there,

I started to convert a HTML template in a ProcessWire site and so far I'm delighted (I'm a MODx refugee also). Right now, my main problem is a psychological one: when I think "page" I see a rectangular piece of paper not doing much :lol:.

Anyway, I created a checkboxes Page field like here and although weird at first, I already see some of the benefits for doing it that way.

I wonder how to make the checkboxes checked when I edit a page using a template containing those checkboxes. My searches on this forum had no results.

Best regards,

Gabi

  • Like 2
Link to comment
Share on other sites

Wow, that must be one of my first ever posts on the forums you've found there :D I know a little bit more about ProcessWire now ;)

Are you talking about editing a page with those checkboxes on, checking one of the boxes then saving the page and editing it later? If so the relevant box should be checked when you go back and edit the page, but I don't think that's what you mean.

Link to comment
Share on other sites

LOL, we're almost two years later, don't "I know a little bit more" me. You may make it look like it is difficult to learn :lol:.

I was searching for a way to have the checkboxes checked by default instead of checking them manually, because their initial state is OFF/not checked.

I needed that for a way to exclude certain pages from the navigation. Although I chose another route now (based on templates' group tags and/or template names), it would still be nice to know the answer.

Link to comment
Share on other sites

Checkboxes can't be checked by default. This is to ensure you use scalable conventions in creating and maintaining your site. For instance, if you added a checkbox to an existing site that already had thousands of pages, and made the default "checked", then that would only apply to newly created pages from there … all of your thousands of existing pages would still be unchecked. Confusion, problems, and potentially a whole lot of work ensues. Whereas if you use checkboxes to toggle a non-default behavior, that is much more scalable and predictable. 

Link to comment
Share on other sites

LOL, we're almost two years later, don't "I know a little bit more" me. You may make it look like it is difficult to learn :lol:.

Good point! Okay, so I know a lot more but didn't want to boast.

I think the biggest hurdle I found when moving from MODx was un-learning the ways of doing things in that system and learning the way of doing things in ProcessWire (some of which seem odd to begin with, but genius when you get going with them).

Back to your checkboxes, the way to do it is like ryan said and hopefully you can re-word the label to be the opposite as long as it still makes sense with the new label?

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