Questionaire - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development


  • Questionaire
  • Hello Sitefinity Team

    I am investigating Sitefinity 4 RC2 if it is possible to build a multiple choice questionaire of 7 questions with the Forms module.
    I need to show an image instead of text for each possible answer in a question. When the user makes an answer selection he should automatically navigate to the next question. Each question must be shown on a different page or on the same page but then with show and hide question functionality.
    Is using the Forms module the right way to solve this? How can I add an image for each possible answer?

    This application must be used in a live situation. Can I use Sitefinity 4 RC2 for this or should I wait till release or use Sitefinity 3.7 ?

    Kind regards
    Luc Baeten
    Hi Luc Baeten,

    Thank you for your interest in Sitefinity 4.0.

    Unfortunately the forms module does not have such functionality. To achieve the feature with the images you will have to create custom forms control which inherits from the default one (FormMultipleChoice). The easiest implementation would be to assign the image as a CSS rule for each label which is rendered next to the choice.

    The second option can be achieved with adding layout controls or directly assingning CSS classes to each widget you drop on the form and jQuery.  For example you drop a multiple choice control on the form. Then go to its editor and from the Appearance section you set the CSS class. For each control you will do this and your theme will set those css classes to be display: none. Then you can use the Generic Content block to put some an html link or button control which when clicked will use jQuery to toggle the display of each question. See attached screencast.

    You can even use the jQery approach for appending images. You will get the jQuery object with class lets say .question1, then you will get all of its children elements and append images with CSS.

    Radoslav Georgiev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  • Hi Radoslav Georgiev

    I understand what you mean with assigning CSS classes. But I can not expect from my customer that he knows what to do here. So probably I have to define a Custom forms multi choice control and add an image selector for each choice.
    I am familiar with creating custom controls in Sitefinity 3.7. Is there a description how to do that for Sitefinety 4 ? Where should I pay attention to?

    Hello Luc Baeten,

    Thank you for getting back to me.

    You can find a tutorial on how to create custom widgets here. Note that you will also need to change the control designer of this control and use a custom one. Control designers in Sitefinity 4.0 are ScriptControls, so you will also need to provide your own client side object. You can add another designer view which will allow users to select images. I have attached sample project which has the necessary infrastructure.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.