function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
West415West415 

Dynamic Label and Checkboxes underneath?

HI,

I'm working with a visualforce page and form and I wanted to display a list if U.S. States as just text with checkboxes underneath each state for the cities in that state. 

So for example:

Nevada
 - Reno
 - Carson City
 - Las Vegas

Colorado
 - Denver
 - Boulder

I have a custom object that stores customer records.  In the address fields I store the city and state.  I want to generate the output above using this data and have a checkbox rendered for each city.

Any ideas on how to do this using visualforce?
 
Shashikant SharmaShashikant Sharma
Hi ,

You should use apex:Repeat (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm) and you could achieve it.

Let me know is you face any issues.

Thanks
Shashikant
Amit Chaudhary 8Amit Chaudhary 8

Example 1:- You can Try picklist for same as well. Please check below post

https://developer.salesforce.com/blogs/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html
http://www.forcetree.com/2009/06/dynamically-add-values-to-picklist.html

Example 2:-  you can create the warpper class for same.
https://developer.salesforce.com/page/Wrapper_Class

Please let us know if this will help you

Thanks
Amit Chaudhary