I am new to the platform and have basically gone through the Force.com Workbook and Fundamentals.

I have a requirement wherein I need to create a questionnaire. I was initially planning to use Visual Workflows. However, after going through the requirements I realised the user would have to click through an average of 6 screens before arriving at the conclusion- which is not desirable.

The reason for this is that basically each subsequent question is based on the answer to the current question and it is quite a complex process.

Is there a way to make fields visible based on the user's response to questions so that the questionnaire can be implemented in a single page?

I'm sure this is possible using Apex, but I was wondering if there is a way to do this without code?

1 Answer 1


When implementing this sort of thing in Salesforce, we have chosen to use jQuery. The conditional rendering gets done in the browser (avoiding slow round trips to the server) making the page nice and responsive.

Yes it is code. But it is a technology well worth learning about if you are not familiar with it. And the separation of concerns - where the jQuery deals just with conditional rendering and the Visualforce/Apex deal with generating the page and saving the results - leads to a clean design.

PS The availability of Custom HTML Attributes in Visualforce means that you can use those to add extra data in the page to help jQuery e.g. relationships between questions to make the logic more data-driven.

  • What's the benefit of jquery to standard VF re-rendering in this specific use case to an end user ? Mar 17, 2014 at 11:11
  • Yeah its just tying the cause and effect closer together in time which makes users more comfortable and avoids users from clicking multiple times before the new version of the page has appeared. (And if you like you can get snazzy with animation effects.) But sure the standard VF re-rendering can be used.
    – Keith C
    Mar 17, 2014 at 11:29
  • @SamuelDeRycke But on second thoughts you posting the VF re-rendering approach as an answer would make lots of sense given the "without code" requirement...
    – Keith C
    Mar 17, 2014 at 11:48
  • Thanks for the suggestions.. would there be a noticeable difference in performance using jQuery over VF re-rendering? I don't mind learning jQuery but I'm wondering if it's worth the effort in the long run?
    – RohanC
    Mar 19, 2014 at 14:03
  • The difference is very noticeable; jQuery appears instant whereas re-rendering involves a delay of 1-2 seconds (depending on view state size, how "warmed up" Salesforce is, network speed). But I guess the question is whether your user's would care one way or the other. And if this is your core product offering you would want it to be as good as possible but if this is just some rarely used corner of a larger product then using re-rendering may well be good enough. Client-side JavaScript including jQuery opens up more options for you the developer so is worth knowing about.
    – Keith C
    Mar 19, 2014 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .