Directory

← Back

Questionnaire for Vaadin

A simple questionnaire component for Vaadin 23, can be used for adding user surveys into an app.

Author

Rating

Popularity

<100

A simple questionnaire component for Vaadin 23, can be used for adding user surveys into an app.

It was inspired by the earlier component by the same name in the Vaadin directory

Questionnaire

with the same data model (almost) but UI components re-written for compatibility with Vaadin 23.

Sample code

QuestionSet questionSet = new QuestionSet();
questionSet.setText("Testing Addon");
questionSet.setDescription("This is questionnaire testing.");
questionSet.setSubmitButtonText("Send");

Question q1 = new Question(1, "Enter your name");
q1.setAnswerMaxLength(100);
q1.setRequired(true);
q1.setRequiredError("Name is required");
questionSet.add(q1);

Question q2 = new Question(2, "Description", QuestionType.TEXTAREA);
q2.setAnswerMaxLength(4000);
q2.setRequired(true);
q2.setRequiredError("Description is required");
questionSet.add(q2);

Question q3 = new Question(3, "Interestings", QuestionType.CHECKBOX);
q3.setRequired(true);
q3.setRequiredError("Interestings are required");
q3.addAnswer("Sports");
q3.addAnswer("Music");
q3.addAnswer("Movies");
q3.addAnswer("Books");
questionSet.add(q3);

Question q4 = new Question(4, "Gender", QuestionType.RADIOBUTTON);
q4.addAnswer("Male");
q4.addAnswer("Female");
q4.setRequiredError("Gender is required");
questionSet.add(q4);

QuestionnaireComponent questionnaire = new QuestionnaireComponent();
questionnaire.addSubmitButtonClickListener(l -> {
	// save the user answers...
	questionnaire.getUserAnswerSet(null);
});

questionnaire.setQuestionSet(questionSet);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Initial version

Released
2022-09-09
Maturity
TESTED
License
Apache License 2.0

Compatibility

Framework
Vaadin 23
Browser
Google Chrome

Questionnaire for Vaadin - Vaadin Add-on Directory

A simple questionnaire component for Vaadin 23, can be used for adding user surveys into an app. Questionnaire for Vaadin - Vaadin Add-on Directory
A simple questionnaire component for Vaadin 23, can be used for adding user surveys into an app. It was inspired by the earlier component by the same name in the Vaadin directory [Questionnaire](https://vaadin.com/directory/component/questionnaire) with the same data model (almost) but UI components re-written for compatibility with Vaadin 23.
Online