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
Paulo CastroPaulo Castro 

An example of using selectCheckboxes + custom object

Hi guys,

 

 do you know if exists an example of use selectCheckboxes with a custom object somewhere? The visual pages developer guide show a very simple example, and I'm trying to do something more complex.

 

 In a few words, what I'm trying to do is:

 

 I have an object called Question, another called Answer and another called Result. As you can imagine, for each record on Question object I have some records on Answer object. This way I can add, delete and update my questionnaire always I need.

 I will render these questions and answers on a custom page, using selectCheckboxes, since users can select many answers they want.

 After user fill the questionnaire, I want to save all answers they checked, in Result object.

 The schema is something like this:

 

 Question

  - Description (text) 

 

 Answer

  - Question (Lookup)

  - Description (text)

 

 Result

  - User (Lookup)

  - Answer (Lookup) 

 

 If an user want to see what he did before, I will render all questions and answers and mark the answers that they checked before.

 

 Until this moment I know I'll need to create a custom page, one controller and these 3 custom objects. But do you think I'll need to create a custom class also to make all this work? 

 

 To be able to render all question and answers I think I'll need to create a loop in the custom page to retrieve all questions and for each one render the correspondent answers. Is that correct? Or exists another easy way to do this?

 

 To render the blank questionnaire I think it will be easy. I was wondering how could I render it and check the answers that an User checked before... any ideas?

 

 Any help on insight is very welcome! :)

 

 Thanks!