Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nextcloud-forms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milan Jaros
nextcloud-forms
Commits
54a952ba
Commit
54a952ba
authored
3 years ago
by
Milan Jaros
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
ab841ffa
Branches
ncc_v2.2.4
No related tags found
1 merge request
!1
Ncc v2.2.4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Questions/Question.vue
+4
-2
4 additions, 2 deletions
src/components/Questions/Question.vue
src/views/Submit.vue
+21
-14
21 additions, 14 deletions
src/views/Submit.vue
with
25 additions
and
16 deletions
src/components/Questions/Question.vue
+
4
−
2
View file @
54a952ba
...
...
@@ -135,10 +135,12 @@ export default {
* @returns {Boolean}
*/
computedText
()
{
const
text
=
this
.
text
.
replace
(
'
[n]
'
,
''
).
replace
(
'
]
'
,
''
).
split
(
'
[
'
)[
0
]
if
(
this
.
mandatory
)
{
return
this
.
text
+
'
*
'
return
text
+
'
*
'
}
return
this
.
text
return
text
},
/**
...
...
This diff is collapsed.
Click to expand it.
src/views/Submit.vue
+
21
−
14
View file @
54a952ba
...
...
@@ -174,7 +174,7 @@ export default {
message
+=
'
'
+
t
(
'
forms
'
,
'
An asterisk (*) indicates mandatory questions.
'
)
}
message
+=
'
'
+
this
.
logError
//
message += ' ' + this.logError
return
message
}
,
...
...
@@ -227,7 +227,17 @@ export default {
this
.
$refs
.
submitButton
.
click
()
}
,
checkQuestion
(
indexQ
,
saveIndex
)
{
checkAnswers
(
indexQ
,
saveIndex
)
{
const
question
=
this
.
form
.
questions
[
indexQ
]
if
(
saveIndex
&&
(
!
this
.
answers
[
question
.
id
]))
{
showError
(
t
(
'
forms
'
,
'
Answer is required
'
))
const
errorMessage
=
{
code
:
499
,
message
:
'
Answer is required
'
}
throw
errorMessage
}
}
,
checkQuestion
(
indexQ
)
{
const
question
=
this
.
form
.
questions
[
indexQ
]
const
qTextSplit1
=
question
.
text
.
replace
(
'
[n]
'
,
''
).
replace
(
'
]
'
,
''
).
split
(
'
[
'
)
// [1/1][1/2][1/3]
...
...
@@ -241,16 +251,11 @@ export default {
if
(
this
.
answers
[
qi
])
{
// "q1": None
const
answers
=
this
.
answers
[
qi
].
filter
(
answer
=>
answer
===
ai
)
// "q1" : [a1,a2,a3,a4]
if
(
!
answers
.
length
)
{
if
(
answers
.
length
===
0
)
{
continue
// no answers, go to next question
}
else
{
return
true
}
}
else
{
if
(
saveIndex
)
{
showError
(
t
(
'
forms
'
,
'
Answer is required
'
))
throw
'
Answer is required
'
;
}
}
}
}
...
...
@@ -264,8 +269,9 @@ export default {
let
index
=
this
.
questionIndex
if
(
this
.
checkQuestion
(
index
))
{
if
(
this
.
checkQuestion
(
index
,
saveIndex
))
{
questionsArray
.
push
(
this
.
form
.
questions
[
index
])
this
.
checkAnswers
(
index
,
saveIndex
)
}
while
(
index
<
this
.
form
.
questions
.
length
-
1
)
{
...
...
@@ -278,6 +284,7 @@ export default {
if
(
this
.
checkQuestion
(
index
,
saveIndex
))
{
questionsArray
.
push
(
this
.
form
.
questions
[
index
])
this
.
checkAnswers
(
index
,
saveIndex
)
}
}
...
...
@@ -298,8 +305,8 @@ export default {
try
{
if
(
this
.
questionIndex
<
this
.
form
.
questions
.
length
-
1
)
{
const
questions
=
this
.
getQuestions
(
true
)
logError
+=
'
'
+
q
uestions
.
length
this
.
getQuestions
(
true
)
const
questions
=
this
.
getQ
uestions
(
false
)
if
(
questions
.
length
>
0
)
{
return
...
...
@@ -314,10 +321,10 @@ export default {
this
.
questionIndex
=
0
this
.
success
=
true
}
catch
(
error
)
{
this
.
questionIndex
=
0
this
.
logError
=
'
'
+
error
//
this.questionIndex = 0
//
this.logError
+
= ' ' + error
console
.
error
(
error
)
showError
(
t
(
'
forms
'
,
'
There was an error
submitt
in
g
the form
'
))
showError
(
t
(
'
forms
'
,
'
There was an error in the form
'
))
}
finally
{
this
.
loading
=
false
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment