Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
em
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ichikawa
em
Commits
18164fdf
Commit
18164fdf
authored
Jan 19, 2024
by
Kim Gyeongeun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#56952 設問設定機能追加(セレクトメニュー動作バグ修正)
parent
702df35c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
156 additions
and
28 deletions
+156
-28
src/main/java/jp/agentec/sinaburocast/service/QuestionService.java
+14
-2
src/main/webapp/WEB-INF/view/user/enquete/enquete.html
+142
-26
No files found.
src/main/java/jp/agentec/sinaburocast/service/QuestionService.java
View file @
18164fdf
...
...
@@ -310,6 +310,9 @@ public class QuestionService extends AbstractService<Question> {
copiedQuestion
.
condRequiredAnswer
=
answerIdArrayStr
.
replaceAll
(
",$"
,
""
);
update
(
copiedQuestion
,
loginId
);
answerIdArrayStr
=
""
;
}
else
if
(
copiedQuestion
.
condRequiredQuestionNo
.
equals
(
0
)
&&
copiedQuestion
.
condRequiredAnswer
!=
null
)
{
copiedQuestion
.
condRequiredAnswer
=
null
;
update
(
copiedQuestion
,
loginId
);
}
}
}
...
...
@@ -325,7 +328,7 @@ public class QuestionService extends AbstractService<Question> {
//初期表示情報セット
for
(
Question
question
:
questionList
)
{
for
(
Answer
answer
:
question
.
answerList
)
{
if
(
question
.
condRequiredQuestionNo
!=
null
&&
question
.
condRequiredQuestionNo
==
0
&&
requiredQuestionInfo
.
get
(
answer
.
answerId
)
==
null
)
{
if
(
question
.
condRequiredQuestionNo
!=
null
/*&& question.condRequiredQuestionNo == 0*/
&&
requiredQuestionInfo
.
get
(
answer
.
answerId
)
==
null
)
{
if
(
answer
.
defaultFlg
==
0
&&
StringUtil
.
isBlank
(
answer
.
answerIdValue
))
{
continue
;}
//条件付回答設定の選択した値
if
(
answer
.
defaultFlg
==
0
&&
StringUtil
.
isNotBlank
(
answer
.
answerIdValue
))
{
...
...
@@ -354,9 +357,18 @@ public class QuestionService extends AbstractService<Question> {
question
.
questionInitDisable
=
SinaburoConstant
.
initDisable
.
YES
;
}
else
{
question
.
questionInitDisable
=
SinaburoConstant
.
initDisable
.
NO
;
return
;
break
;
}
}
}
}
//グレーアウト処理した項目を初期化
for
(
Question
question
:
questionList
)
{
if
(
question
.
questionInitDisable
==
SinaburoConstant
.
initDisable
.
YES
)
{
for
(
Answer
answer
:
question
.
answerList
)
{
answer
.
answerIdValue
=
""
;
answer
.
answerValue
=
""
;
}
}
}
}
...
...
src/main/webapp/WEB-INF/view/user/enquete/enquete.html
View file @
18164fdf
...
...
@@ -28,19 +28,88 @@ $(function() {
#foreach($answer in $question.answerList)
<script
language=
"javascript"
type=
"text/javascript"
charset=
"utf-8"
>
<!--
function
radioOrCheckboxEvent
(
id
,
isDisable
)
{
$
(
"#"
+
id
).
trigger
(
"click"
);
if
(
isDisable
)
{
$
(
"#"
+
id
).
attr
(
"checked"
,
false
);
$
(
"#"
+
id
).
attr
(
"disabled"
,
true
);
}
else
{
$
(
"#"
+
id
).
attr
(
"disabled"
,
false
);
}
}
function
dateEvent
(
id
,
isDisable
)
{
if
(
isDisable
)
{
$
(
"."
+
id
).
val
(
''
);
$
(
"."
+
id
).
attr
(
"disabled"
,
true
);
$
(
"."
+
id
).
next
().
hide
();
}
else
{
$
(
"."
+
id
).
attr
(
"disabled"
,
false
);
$
(
"."
+
id
).
next
().
show
();
}
}
function
etcEvent
(
id
,
isDisable
)
{
if
(
isDisable
)
{
$
(
"#"
+
id
).
val
(
''
);
$
(
"#"
+
id
).
attr
(
"disabled"
,
true
);
}
else
{
$
(
"#"
+
id
).
attr
(
"disabled"
,
false
);
}
}
$
(
function
()
{
//条件付必須チェック
$
(
"input[type=radio], input[type=checkbox], input[type=select]"
).
click
(
function
()
{
//条件付必須チェック(セレクトメニュー)
$
(
'select'
).
change
(
function
()
{
var
selectQuestionId
=
$
(
this
).
attr
(
"id"
);
var
selectAnswerId
=
$
(
this
).
val
();
//表示、非表示対象
if
(
$
{
question
.
condRequiredQuestionNo
}
&&
$
{
question
.
condRequiredQuestionNo
}
==
selectQuestionId
)
{
//グレーアウト対象
if
(
"${question.condRequiredAnswer}"
.
split
(
","
).
indexOf
(
selectAnswerId
)
<
0
)
{
if
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
)
{
radioOrCheckboxEvent
(
"${answer.answerId}"
,
true
);
}
else
if
(
"${question.controlId}"
==
"2"
||
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
||
"${question.controlId}"
==
"5"
||
"${question.controlId}"
==
"6"
)
{
if
(
"${question.controlId}"
!=
"5"
)
{
etcEvent
(
"${question.questionId}"
,
true
);
}
else
{
dateEvent
(
"${question.questionId}"
,
true
);
}
}
//グレーアウト解除
}
else
{
if
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
)
{
radioOrCheckboxEvent
(
"${answer.answerId}"
,
false
);
}
else
if
(
"${question.controlId}"
==
"2"
||
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
||
"${question.controlId}"
==
"5"
||
"${question.controlId}"
==
"6"
)
{
if
(
"${question.controlId}"
!=
"5"
)
{
etcEvent
(
"${question.questionId}"
,
false
);
}
else
{
dateEvent
(
"${question.questionId}"
,
false
);
}
}
}
}
});
//条件付必須チェック(ラジオボタン、チェックボックス)
$
(
"input[type=radio], input[type=checkbox]"
).
click
(
function
()
{
var
thisQuestionId
=
$
(
this
).
attr
(
"class"
);
var
thisAnswerId
=
$
(
this
).
attr
(
"id"
);
//表示、非表示対象
if
(
$
{
question
.
condRequiredQuestionNo
}
&&
$
{
question
.
condRequiredQuestionNo
}
==
thisQuestionId
)
{
//グレーアウト対象
if
(
"${question.condRequiredAnswer}"
.
split
(
","
).
indexOf
(
thisAnswerId
)
<
0
)
{
if
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
)
{
$
(
"#${answer.answerId}"
).
attr
(
"checked"
,
false
);
$
(
"#${answer.answerId}"
).
attr
(
"disabled"
,
true
);
}
else
if
(
$
(
this
).
attr
(
"type"
)
==
"radio"
&&
"${question.controlId}"
==
"2"
)
{
if
(
$
(
this
).
attr
(
"type"
)
==
"radio"
&&
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
))
{
if
(
$
(
this
).
is
(
":checked"
))
{
radioOrCheckboxEvent
(
"${answer.answerId}"
,
true
);
}
else
{
var
array
=
"${question.condRequiredAnswer}"
.
split
(
","
);
var
judgeDisable
=
true
;
for
(
let
i
in
array
)
{
...
...
@@ -50,26 +119,48 @@ $(function() {
}
}
if
(
judgeDisable
)
{
$
(
"#${question.questionId}"
).
val
(
''
);
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
true
);
radioOrCheckboxEvent
(
"${answer.answerId}"
,
true
);
}
}
}
else
if
(
"${question.controlId}"
==
"2"
||
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
||
"${question.controlId}"
==
"5"
||
"${question.controlId}"
==
"6"
)
{
if
(
"${question.controlId}"
==
"2"
)
{
$
(
"#${question.questionId}"
).
trigger
(
"change"
);
}
if
(
$
(
this
).
attr
(
"type"
)
==
"radio"
)
{
if
(
$
(
this
).
is
(
":checked"
))
{
var
array
=
"${question.condRequiredAnswer}"
.
split
(
","
);
var
judgeDisable
=
true
;
for
(
let
i
in
array
)
{
if
(
$
(
"#"
+
array
[
i
]).
is
(
":checked"
))
{
judgeDisable
=
false
;
break
;
}
}
if
(
judgeDisable
)
{
if
(
"${question.controlId}"
!=
"5"
)
{
etcEvent
(
"${question.questionId}"
,
true
);
}
else
{
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
fals
e
);
dateEvent
(
"${question.questionId}"
,
tru
e
);
}
}
else
if
(
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
||
"${question.controlId}"
==
"6"
)
{
$
(
"#${question.questionId}"
).
val
(
''
);
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
true
);
}
else
if
(
"${question.controlId}"
==
"5"
)
{
$
(
".${question.questionId}"
).
val
(
''
);
$
(
".${question.questionId}"
).
attr
(
"disabled"
,
true
);
$
(
".${question.questionId}"
).
next
().
hide
();
}
}
else
{
if
(
"${question.controlId}"
!=
"5"
)
{
etcEvent
(
"${question.questionId}"
,
false
);
}
else
{
dateEvent
(
"${question.questionId}"
,
false
);
}
}
}
}
//グレーアウト解除
}
else
{
if
(
"${question.controlId}"
==
"0"
||
"${question.controlId}"
==
"1"
)
{
$
(
"#${answer.answerId}"
).
attr
(
"disabled"
,
false
);
}
else
if
(
"${question.controlId}"
==
"2"
)
{
if
(
$
(
this
).
is
(
":checked"
))
{
$
(
"#${question.questionId}"
).
attr
(
"disabled
"
,
false
);
radioOrCheckboxEvent
(
"${answer.answerId}
"
,
false
);
}
else
{
var
array
=
"${question.condRequiredAnswer}"
.
split
(
","
);
var
judgeDisable
=
true
;
...
...
@@ -80,15 +171,40 @@ $(function() {
}
}
if
(
judgeDisable
)
{
$
(
"#${question.questionId}"
).
val
(
''
);
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
true
);
radioOrCheckboxEvent
(
"${answer.answerId}"
,
true
);
}
}
}
else
if
(
"${question.controlId}"
==
"2"
||
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
||
"${question.controlId}"
==
"5"
||
"${question.controlId}"
==
"6"
)
{
if
(
"${question.controlId}"
==
"2"
)
{
$
(
"#${question.questionId}"
).
trigger
(
"change"
);
}
if
(
$
(
this
).
is
(
":checked"
))
{
if
(
"${question.controlId}"
!=
"5"
)
{
etcEvent
(
"${question.questionId}"
,
false
);
}
else
{
dateEvent
(
"${question.questionId}"
,
false
);
}
}
else
{
var
array
=
"${question.condRequiredAnswer}"
.
split
(
","
);
var
judgeDisable
=
true
;
for
(
let
i
in
array
)
{
if
(
$
(
"#"
+
array
[
i
]).
is
(
":checked"
))
{
judgeDisable
=
false
;
break
;
}
}
if
(
judgeDisable
)
{
if
(
"${question.controlId}"
!=
"5"
)
{
etcEvent
(
"${question.questionId}"
,
true
);
}
else
{
dateEvent
(
"${question.questionId}"
,
true
);
}
}
}
}
else
if
(
"${question.controlId}"
==
"3"
||
"${question.controlId}"
==
"4"
||
"${question.controlId}"
==
"6"
)
{
$
(
"#${question.questionId}"
).
attr
(
"disabled"
,
false
);
}
else
if
(
"${question.controlId}"
==
"5"
)
{
$
(
".${question.questionId}"
).
attr
(
"disabled"
,
false
);
$
(
".${question.questionId}"
).
next
().
show
();
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment