Jump to content

how to use checkbox


closer12
 Share

Recommended Posts

Hi. I am new on processwire. 

I want to add checkbox fields to my page  edit and when if they are selected. I want to show the text in the front page.

I couldnt find where i can enter the value of checkbox   and how to show in theme ?

Can you give me a small example ? 

I took the snap from this video ( http://processwire.com/videos/field-dependencies/ ) i want to do smilar.   thank you

post-2380-0-16712500-1402416999_thumb.jp

Link to comment
Share on other sites

It's in the page tree.

Selects and Checkboxes are infact pages (Fieldtype Page). 

For the page references, select the options page as parent. Look at the page tree below. 

options ( options template )
  |
  +-- option one ( option template )
  |
  +-- option two ( option template )
  |
  +-- option three ( option template )

  • Like 2
Link to comment
Share on other sites

It actually depends a bit whether you want a single checkbox, or an array of checkbox items to choose from. The former is simply a matter a creating a field of type checkbox. The latter is what Martijn is talking about and requires creating a pagefield.

  • Like 2
Link to comment
Share on other sites

Do you want to control the display of your pages with a checkbox? That means, if you assign the checkbox in a page, this page will be shown in the frontend?

Or do you want control specific elements (like body, title...) of your page?

Link to comment
Share on other sites

my question is very simple.

I want to make a one checkbox and if this checkbox is checked i want to show some text in the page ...

But i couldnt find  where i can enter that text when i create a checkbox in the fields. and how to show in the template.  i need very simple example for understanding.

My checkbox name is :  check

İ added this to template : 

<?php echo $page->check; ?>

and when i checked its show :  1   

but how i can show a text ?

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

×
×
  • Create New...