LeslieC Posted August 21, 2011 Share Posted August 21, 2011 Hey guys, This is probably a stupid question, but how do I add options to custom field checkbox Normally when you have checkbox you can add option like red,blue,green,.... so you can select the option you like, but I cant figure out where to add the options Thanks Leslie Link to comment Share on other sites More sharing options...
drilonb Posted August 22, 2011 Share Posted August 22, 2011 At fields Add New Field -> Type -> Checkbox and you can name it what ever you want and in template you can set up which checkbox to show Find 3 of the most recent children that have a red checkbox set, and display links to them: <?php $red= $page->children("red=1, limit=3, sort=-date"); foreach($red as $redcolor) echo "<p>Red Color: <a href='{$redcolor->url}'>{$redcolor->title}</a></p>"; Link to comment Share on other sites More sharing options...
LeslieC Posted August 22, 2011 Author Share Posted August 22, 2011 So the checkbox is only single checkbox for marking like a future page. But how to make multiple checkbox like in the attachment, so only selected boxes will show on the site ? Thanks Link to comment Share on other sites More sharing options...
Soma Posted August 22, 2011 Share Posted August 22, 2011 This is not implemented like this in PW. Either make a checkbox for each option and put them in a fieldset... or, use pages for creating the options that can then be selected in your page using page reference field and a multiple select inputfield. check this thread: http://processwire.com/talk/index.php/topic,359.0.html Link to comment Share on other sites More sharing options...
ryan Posted August 22, 2011 Share Posted August 22, 2011 Here is the recommended way to do this in ProcessWire (using your example): 1. Create a page: /options/favorite-foods/ (for example). Though call it whatever you want and place it wherever you want. 2. Add child pages: /options/favorite-foods/chocolate /options/favorite-foods/pizza /options/favorite-foods/gum /options/favorite-foods/waffles /options/favorite-foods/ice-cream /options/favorite-foods/donuts /options/favorite-foods/chips 3. Add a new "Page" reference field in Setup > Fields. Call it 'favorite_foods' (or whatever you want) For 'Dereference in API as', choose 'Multiple Pages' For 'Parent of selectable pages' select '/options/favorite-foods/' For 'Input field type' choose 'Checkboxes' 4. Add the new favorite_foods field to whatever templates you want, and you are set. More info: Need to add a new option? Add a new page under /pages/favorite-foods/ Want to do something cool with the template your favorite foods are using? Add this: <?php $links = $pages->find("favorite_foods=$page"); echo $links->render(); That would list all pages that had that particular favorite food selected. Perhaps this is a useful page in your site? Once you get used to the power of creating options this way, you won't want to do it any other way. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now