SurveyJS 是一个强大的、可定制的、跨平台的 Survey/Feedback/Questionnaire/Quiz JavaScript 库,专为 jQuery、Angular、React、VueJS、knockout 等而设计。
主要特点:
-
支持的问题类型:输入、单选、复选框、下拉、矩阵、评分、图片选择器、评论、自定义功能等。
-
在问题之间共享数据。
-
打印为 PDF。
-
分析调查结果。
-
支持条件逻辑。
-
Markdown 和文本处理。
-
多种语言。
-
表单验证。
-
8个内置主题。
-
支持第三个插件:select2、jQuery UI 日期选择器、Nouislider等等。
基本用法(jQuery):
1. 在页面上包含 jQuery 库和 SurveyJS 库的文件。
<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/survey.jquery.js"></script>
<link href="/path/to/survey.css" type="text/css" rel="stylesheet"/>
2. 使用 JSON 定义您的问题。您可以使用在线调查编辑器构建自己的 JSON 。
var json = {
"completedHtml": "<h3>Thank you for your feedback.</h3> <h5>Your thoughts and ideas will help us to create a great product!</h5>",
"completedHtmlOnCondition": [
{
"expression": "{nps_score} > 8",
"html": "<h3>Thank you for your feedback.</h3> <h5>We glad that you love our product. Your ideas and suggestions will help us to make our product even better!</h5>"
}, {
"expression": "{nps_score} < 7",
"html": "<h3>Thank you for your feedback.</h3> <h5> We are glad that you share with us your ideas.We highly value all suggestions from our customers. We do our best to improve the product and reach your expectation.</h5>\n"
}
],
"pages": [
{
"name": "page1",
"elements": [
{
"type": "rating",
"name": "nps_score",
"title": "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?",
"isRequired": true,
"rateMin": 0,
"rateMax": 10,
"minRateDescription": "(Most unlikely)",
"maxRateDescription": "(Most likely)"
}, {
"type": "checkbox",
"name": "promoter_features",
"visibleIf": "{nps_score} >= 9",
"title": "What features do you value the most?",
"isRequired": true,
"validators": [
{
"type": "answercount",
"text": "Please select two features maximum.",
"maxCount": 2
}
],
"hasOther": true,
"choices": [
"Performance", "Stability", "User Interface", "Complete Functionality"
],
"otherText": "Other feature:",
"colCount": 2
}, {
"type": "comment",
"name": "passive_experience",
"visibleIf": "{nps_score} > 6 and {nps_score} < 9",
"title": "What is the primary reason for your score?"
}, {
"type": "comment",
"name": "disappointed_experience",
"visibleIf": "{nps_score} notempty",
"title": "What do you miss and what was disappointing in your experience with us?"
}
]
}
],
"showQuestionNumbers": "off"
};
3. 创建一个容器来放置调查。
<div id="myContainer"></div>
4. 从您提供的 JSON 生成一个 surver 表单。
window.survey = new Survey.Model(json);
$("#myContainer").Survey({
model: survey,
onComplete: sendDataToServer
});
5. 示例 JS 展示了如何将结果发送到您的服务器。
function sendDataToServer(survey) {
var resultAsString = JSON.stringify(survey.data);
// send the resultAsString to the server
}
6. The example JS that shows how to send the results to your server.
function sendDataToServer(survey) {
var resultAsString = JSON.stringify(survey.data);
// send the resultAsString to the server
}
7. Set the theme you'd like to use. All themes:
Survey.StylesManager.applyTheme("bootstrap");
Survey.StylesManager.applyTheme("orange");
Survey.StylesManager.applyTheme("darkblue");
Survey.StylesManager.applyTheme("darkrose");
Survey.StylesManager.applyTheme("stone");
Survey.StylesManager.applyTheme("winter");
Survey.StylesManager.applyTheme("winterstone");
Changelog:
v1.8.64 (2021-09-01)
-
Bug Fixes
v1.8.62 (2021-08-25)
-
Bug Fixes
v1.8.61 (2021-08-19)
-
Bug Fixes
v1.8.60 (2021-08-12)
-
Bug Fixes
v1.8.59 (2021-08-04)
-
Bug Fixes
v1.8.58 (2021-07-29)
-
Bug Fixes
v1.8.57 (2021-07-21)
-
Bug Fixes
v1.8.56 (2021-07-14)
-
Bug Fixes
v1.8.55 (2021-07-07)
-
Bug Fixes
v1.8.54 (2021-06-30)
-
Bug Fixes
v1.8.53 (2021-06-16)
-
Bug Fixes
v1.8.52 (2021-06-16)
-
Fixed: Show invisible elements doesn't work in react
v1.8.51 (2021-06-10)
-
Fixed: Show invisible elements doesn't work in reac
v1.8.50 (2021-06-04)
-
Bug Fixes
v1.8.49 (2021-05-26)
-
Bug Fixes
v1.8.48 (2021-05-20)
-
Bug Fixes
v1.8.47 (2021-05-14)
-
Bug Fixes
v1.8.46 (2021-04-30)
-
Bug Fixes
v1.8.45 (2021-04-28)
-
Do not get "Select All", "None" and "Others" choices when copy them from choicesFromQuestion
-
Issue on combination between default value on question + single page survey + visibleif on choice
-
Peformance improvements on loading and value changing for very large surveys
-
Text processing doesn't work correctly in matrix dropdown/dynamic columns in knockout
v1.8.44 (2021-04-21)
-
Fixed: Bug on clean answers on complete on choices from web property
-
Fixed: Creator V2: Localizable properties may show default values from another properties in matrix dynamic
-
Fixed: Do not modify expression questions if survey in display mode
-
Fixed: Incorrect default value for panelRemoveButtonLocation property
-
Fixed: MultipleText question set empty string as value for their items
-
Fixed: Vue (radiogroup and checkbox questions): enableIf in choices property doesn't work correctly
v1.8.43 (2021-04-15)
-
Fixed: rateValues property in Rating question has "rates" name in property hash
v1.8.42 (2021-04-14)
-
Fixed: showInvisibleElements prop show only empty divs with class "sv-vue-row-additional-div"
-
Fixed: survey.clear() doesn't clear other text if defaultValue is "other"
-
Fixed: visibleIf does not work on subsequent pages for Vue implementation only
v1.8.41 (2021-04-06)
-
Reduce the number of calls for survey.onGetMatrixRowActions event.
v1.8.40 (2021-04-05)
-
Fixed: question.indent and panel.indent doesn't work when they are inside dynamic panel
-
Fixed: Unable to Preview a Matrix Dynamic inside of a Panel Dynamic
v1.8.39 (2021-03-31)
-
Update
v1.8.38 (2021-03-30)
-
Bugfixes
v1.8.37 (2021-03-24)
-
Bugfixes
v1.8.36 (2021-03-15)
-
Fixed: itemSize property doesn't work for multipleText question
-
Fixed: size property in text question doesn't work
v1.8.35 (2021-03-12)
-
Improve responsive matrix rendering
v1.8.34 (2021-03-05)
-
Fixed: Simple custom component doesn't work in matrixdynamic
v1.8.33 (2021-03-02)
-
Fixed: displayValue property doesn't work correctly for components (single and composite)
-
Fixed: visibleIf doesn't work in composite component on calling showPreview()/cancelPreview()
2021-02-24
-
v1.8.32 Fixed: visibleIf doesn't work in composite component when rendering in show preview model
2021-02-16
-
v1.8.31
2021-02-11
-
v1.8.30: Carry forward doesn't work properly with the predefined survey.data
2021-02-03
-
v1.8.29: bugfix
2021-01-29
-
v1.8.28: Allows to enter empty value into required question when survey.checkErrorsMode equals 'onValueChanging'
2021-01-28
-
v1.8.27: Allows to enter empty value into required question when survey.checkErrorsMode equals 'onValueChanging'
2021-01-20
-
v1.8.26: Fixed question defaultValueExpression doesn't support async functions
2021-01-15
-
v1.8.25: Bug Fixes
2021-01-13
-
v1.8.24: Bug Fixes
2020-12-29
-
v1.8.23: Update
2020-12-23
-
v1.8.22: Update
2020-12-15
-
v1.8.21: Bug Fixes
2020-12-09
-
v1.8.20: Update
2020-12-08
-
v1.8.19: Bug Fixes
2020-12-01
-
v1.8.18: Add parentQuestion for question
2020-11-26
-
v1.8.17: Bugfixes
2020-11-25
-
v1.8.16: Bugfixes
2020-11-19
-
v1.8.14: Bugfixes
2020-11-09
-
v1.8.13: Bugfixes
2020-10-28
-
v1.8.12: Bugfixes
2020-10-23
-
v1.8.11: Bugfixes
2020-10-21
-
v1.8.10: Update package
2020-10-14
-
v1.8.9: Fixed: Locale of progressbar does not change
2020-10-09
-
v1.8.8: Added missing translations
2020-10-06
-
v1.8.7: Add survey.runTriggers() function
2020-09-29
-
v1.8.6: Bug Fixes
2020-09-29
-
v1.8.5: Bug Fixes
2020-09-22
-
v1.8.4: Bug Fixes
2020-09-16
-
v1.8.3: Bug Fixes
2020-09-11
-
v1.8.2: Bug Fixes: Pressing markdown link focuses the answer input
2020-09-09
-
v1.8.1: Bug Fixes
2020-09-03
-
v1.8.0: Bug Fixes
2020-08-25
-
v1.7.27: Fixed: Questions doesn't render correctly if there is a locale key in the end of JSON
2020-08-19
-
v1.7.27: Fixed: Incorrect detection of the requiredInAllRowsError in matrix question
2020-08-12
-
v1.7.26: Bugfixed
2020-08-05
-
v1.7.25: Bugfixed
2020-07-28
-
v1.7.24: survey.onGetQuestionTitle event has incorrect options.question parameter
2020-07-22
-
v1.7.23: Update package
2020-07-15
-
v1.7.20: Fixed header attribute value in matrixdynamic cells
2020-07-10
-
v1.7.19: Fixed Error box doesn't disappear when other value is entered
2020-07-05
-
v1.7.18: Add isCompleteOnTrigger option into onCompleting and onCompleted events
2020-07-01
-
v1.7.17: update
2020-07-01
-
v1.7.16: update
2020-06-25
-
v1.7.15: Bugfixes
2020-06-24
-
v1.7.13: Bugfixes
2020-06-16
-
v1.7.12: Fixed serialization for the attachOriginalItems property
2020-06-11
-
v1.7.11: Rollback the fix: SelectBase has wrong ItemValue instances in markup after question converted to other type
2020-06-03
-
v1.7.10: Do not show an error in several rows for matrixdropdown (showInMultipleColumns + columnLayout: 'vertical')
2020-05-28
-
v1.7.9: Render TextArea in display as div
2020-05-26
-
v1.7.8: Fixed goNextPageAutomatic not triggering validation errors
2020-05-20
-
v1.7.7: Updating Navigation button text will not call 'onModified' and 'saveSurveyFunc'
2020-05-13
-
v1.7.6: Fixed Checkbox question doesn't keep it's comment value on changing survey.isSinglePage
2020-05-07
-
v1.7.5: Maximum call stack size exceeded - matrix dropdown with totals and boolean column
2020-04-30
-
v1.7.4: Special fixes for vue
2020-04-22
-
v1.7.3: Use calc function for element.renderedWidth if there is pre-setup width on the same line
2020-04-17
-
v1.7.2: Bugs fixed
2020-04-15
-
v1.7.1: Bugs fixed
2020-04-08
-
v1.5.19: Fixed [Modern Theme] Dropdown choices painted in red on error
2020-03-31
-
v1.5.18: Fixed question.addConditionObjectsByContext function doesn't use valueName
2020-03-25
-
v1.5.17: Update
2020-03-19
-
v1.5.16: Update
2020-03-12
-
v1.5.15: Update
2020-03-12
-
v1.5.14: Removed unused rule
2020-03-05
-
v1.5.13: Bug fixed
2020-02-29
-
v1.5.12: Bug fixed
2020-02-28
-
v1.5.11: Bug fixed
2020-02-19
-
v1.5.10: Bug fixed
2020-02-15
-
v1.5.9: Add public operator property into BinaryOperand
2020-02-13
-
v1.5.8: Fixed onValueChanging bug.
2020-02-12
-
v1.5.7: Added CSS class name for comment in the file question type
2020-02-07
-
v1.5.6: Bugfix
2020-02-04
-
v1.5.5: Bugfix
2020-02-01
-
v1.5.4: Bugfix
2020-01-31
-
v1.5.3: Fix the bug: clear files for QuestionFile on removing panel in paneldynamic
2020-01-30
-
v1.5.2: Bugfix
2020-01-10
-
v1.1.31: Bugfixes
2019-12-11
-
v1.1.24: Decrease margin-right for inline imagepicker item
2019-12-03
-
v1.1.23: Decrease margin-right for inline imagepicker item
2019-11-27
-
v1.1.22: Decrease margin-right for inline imagepicker item
2019-11-19
-
v1.1.21: Decrease margin-right for inline imagepicker item
2019-11-14
-
v1.1.20: Add currencySymbol to cultureInfo
2019-11-07
-
v1.1.19: Update & bugfix
2019-10-30
-
v1.1.18: Update & bugfix
2019-10-23
-
v1.1.17: Update & bugfix
2019-10-17
-
v1.1.16: Update & bugfix
2019-10-09
-
v1.1.15: Fix react margin collapsing
2019-10-02
-
v1.1.14
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。