New Question type. Just a Month-Year type with a month drop down and a 4 digit year text box.
This commit is contained in:
parent
2151730767
commit
cafd31f87a
4 changed files with 48 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
7.7.1
|
||||
- rfe #9353: Welcome message template
|
||||
|
||||
- rfe #10007: New Month and Year question type. If required, Month must be selected and a 4 digit year must be entered.
|
||||
7.7.0
|
||||
- fixed #9913: New Content Side Bar missing in Asset window
|
||||
- fixed: New Mail macro never returns any messages
|
||||
|
|
|
|||
|
|
@ -1219,8 +1219,10 @@ sub prepareShowSurveyTemplate {
|
|||
my %text = ( 'Text', 1, 'Email', 1, 'Phone Number', 1, 'Text Date', 1, 'Currency', 1 );
|
||||
my %slider = ( 'Slider', 1, 'Dual Slider - Range', 1, 'Multi Slider - Allocate', 1 );
|
||||
my %dateType = ( 'Date', 1, 'Date Range', 1 );
|
||||
my %dateShort = ( 'Year Month', 1 );
|
||||
my %fileUpload = ( 'File Upload', 1 );
|
||||
my %hidden = ( 'Hidden', 1 );
|
||||
use Data::Dumper;
|
||||
|
||||
foreach my $q (@$questions) {
|
||||
if ( $fileUpload{ $q->{questionType} } ) { $q->{fileLoader} = 1; }
|
||||
|
|
@ -1236,6 +1238,26 @@ sub prepareShowSurveyTemplate {
|
|||
elsif ( $dateType{ $q->{questionType} } ) {
|
||||
$q->{dateType} = 1;
|
||||
}
|
||||
elsif ( $dateShort{ $q->{questionType} } ) {
|
||||
$q->{dateShort} = 1;
|
||||
foreach my $a(@{$q->{answers}}){
|
||||
$a->{months} = [
|
||||
{'month' => ''},
|
||||
{'month' => 'January'},
|
||||
{'month' => 'February'},
|
||||
{'month' => 'March'},
|
||||
{'month' => 'April'},
|
||||
{'month' => 'May'},
|
||||
{'month' => 'June'},
|
||||
{'month' => 'July'},
|
||||
{'month' => 'August'},
|
||||
{'month' => 'September'},
|
||||
{'month' => 'October'},
|
||||
{'month' => 'November'},
|
||||
{'month' => 'December'}
|
||||
];
|
||||
}
|
||||
}
|
||||
elsif ( $slider{ $q->{questionType} } ) {
|
||||
$q->{slider} = 1;
|
||||
if ( $q->{questionType} eq 'Dual Slider - Range' ) {
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ my @SPECIAL_QUESTION_TYPES = (
|
|||
'File Upload',
|
||||
'Date',
|
||||
'Date Range',
|
||||
'Year Month',
|
||||
'Hidden',
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ if (typeof Survey === "undefined") {
|
|||
'Dual Slider - Range': 1,
|
||||
'Multi Slider - Allocate': 1
|
||||
};
|
||||
var DATE_SHORT = {
|
||||
'Year Month': 1
|
||||
};
|
||||
var DATE_TYPES = {
|
||||
'Date': 1,
|
||||
'Date Range': 1
|
||||
|
|
@ -62,6 +65,16 @@ if (typeof Survey === "undefined") {
|
|||
alert("Please allocate the remaining " + amountLeft + ".");
|
||||
}
|
||||
}
|
||||
else if (toValidate[i].type === 'Year Month') {
|
||||
answered = 1;//set to true, then let a single failure set it back to false.
|
||||
for (var z1 in toValidate[i].answers) {
|
||||
var m = document.getElementById(z1+'-month').value;
|
||||
var y = document.getElementById(z1+'-year').value;
|
||||
if(m == ''){ answered = 0; }
|
||||
if(y.length != 4) { answered = 0; }
|
||||
if(answered == 1){ document.getElementById(z1).value = m + "-" + y; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var z1 in toValidate[i].answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(toValidate[i].answers, z1)) {
|
||||
|
|
@ -395,7 +408,17 @@ if (typeof Survey === "undefined") {
|
|||
toValidate[q.id].type = q.questionType;
|
||||
toValidate[q.id].answers = [];
|
||||
}
|
||||
|
||||
|
||||
if (DATE_SHORT[q.questionType]) {
|
||||
for (var k = 0; k < q.answers.length; k++) {
|
||||
var ans = q.answers[k];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].type = q.questionType;
|
||||
toValidate[q.id].answers[ans.id] = 1;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (DATE_TYPES[q.questionType]) {
|
||||
for (var k = 0; k < q.answers.length; k++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue