Skip to content

Commit

Permalink
Added number and single-line text survey form types
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTschudi committed May 6, 2016
1 parent 59bc5b0 commit 34a60dc
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
32 changes: 32 additions & 0 deletions js/app/survey.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ define([], function () {
question += survey._createListChoice(iQuestion, questionInfo, isReadOnly);
} else if (questionInfo.style === "dropdown") {
question += survey._createDropdownChoice(iQuestion, questionInfo, isReadOnly);
} else if (questionInfo.style === "number") {
question += survey._createNumberInput(iQuestion, questionInfo, isReadOnly);
} else if (questionInfo.style === "text") {
question += survey._createTextLineInput(iQuestion, questionInfo, isReadOnly);
}
question += survey._wrapupQuestion();
$(surveyContainer).append(question);
Expand Down Expand Up @@ -327,6 +331,34 @@ define([], function () {
return list;
},

/**
* Creates a survey question's response response item's HTML: a number input field.
* @param {number} iQuestion Zero-based question number
* @param {object} questionInfo Survey question, which contains question, field, style, domain, important
* @param {boolean} isReadOnly Indicates if survey form elements are read-only
* @return {object} HTML for radio buttons
* @private
*/
_createNumberInput: function (iQuestion, questionInfo, isReadOnly) {
// <input id='q1' type='number' class='number-input'>
var list = "<input id='q" + iQuestion + "' type='number' class='number-input'>";
return list;
},

/**
* Creates a survey question's response response item's HTML: a single-line text input field.
* @param {number} iQuestion Zero-based question number
* @param {object} questionInfo Survey question, which contains question, field, style, domain, important
* @param {boolean} isReadOnly Indicates if survey form elements are read-only
* @return {object} HTML for radio buttons
* @private
*/
_createTextLineInput: function (iQuestion, questionInfo, isReadOnly) {
// <input id='q1' type='text' class='text-input'>
var list = "<input id='q" + iQuestion + "' type='text' class='text-input'>";
return list;
},

/**
* Completes the HTML for a survey question.
* @return {object} HTML for the end of its div
Expand Down
22 changes: 22 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ body {
white-space: normal;
min-height: 2.6em;
}
.number-input {
font-size: 12px;
font-weight: bold;
color: #007ac2;
background-color: #fff;
border: 1px solid #007ac2;
white-space: normal;
min-height: 2.6em;
padding-left: 4px;
max-width: 100%;
}
.text-input {
font-size: 12px;
font-weight: bold;
color: #007ac2;
background-color: #fff;
border: 1px solid #007ac2;
white-space: normal;
min-height: 2.6em;
padding-left: 4px;
width: 100%;
}
.modal-header {
font-weight: bolder;
}
Expand Down

0 comments on commit 34a60dc

Please sign in to comment.