Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
ddc64b35
Commit
ddc64b35
authored
Nov 30, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better layout for various validation messages
parent
aad12603
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
69 deletions
+93
-69
comex_reg.css
static/css/comex_reg.css
+33
-12
comex_reg_form_controllers.js
static/js/comex_reg_form_controllers.js
+25
-20
base_form.html
templates/base_form.html
+34
-35
thank_you.html
templates/thank_you.html
+1
-2
No files found.
static/css/comex_reg.css
View file @
ddc64b35
...
@@ -28,6 +28,14 @@
...
@@ -28,6 +28,14 @@
}
}
.cartouche
{
border
:
.4em
dotted
#988
;
border-radius
:
2em
;
padding
:
1em
3em
;
text-align
:
center
;
}
/* ==> a question + input block <== */
/* ==> a question + input block <== */
.question
{
.question
{
padding
:
0
1em
;
padding
:
0
1em
;
...
@@ -55,13 +63,6 @@
...
@@ -55,13 +63,6 @@
min-width
:
7.5em
;
min-width
:
7.5em
;
}
}
/* the main validation message (a special legend) */
#main_validation_message
{
font-size
:
200%
;
text-align
:
center
;
/*color: #554 ;*/
}
/* the question's additional legend or caption */
/* the question's additional legend or caption */
.legend
{
.legend
{
font-family
:
Cambria
,
serif
;
font-family
:
Cambria
,
serif
;
...
@@ -99,12 +100,16 @@ h3.formcat {
...
@@ -99,12 +100,16 @@ h3.formcat {
margin-top
:
2em
;
margin-top
:
2em
;
}
}
h3
.formcatfirst
{
margin-top
:
.5em
;
}
.spacerrow
{
.spacerrow
{
height
:
4
em
;
height
:
2
em
;
}
}
.bigspacerrow
{
.bigspacerrow
{
height
:
50
em
;
height
:
15
em
;
}
}
.realperson-challenge
{
.realperson-challenge
{
...
@@ -116,9 +121,6 @@ h3.formcat {
...
@@ -116,9 +121,6 @@ h3.formcat {
.realperson-regen
{
.realperson-regen
{
color
:
#554
;
color
:
#554
;
}
}
.bigspacerrow
{
height
:
50em
;
}
.raw-responses
{
.raw-responses
{
font-family
:
Calibri
,
sans-serif
;
font-family
:
Calibri
,
sans-serif
;
...
@@ -128,3 +130,22 @@ h3.formcat {
...
@@ -128,3 +130,22 @@ h3.formcat {
color
:
white
;
color
:
white
;
padding-bottom
:
3em
padding-bottom
:
3em
}
}
/* the main validation message (a special legend) */
#main_validation_message
{
font-size
:
200%
;
text-align
:
center
;
/*color: #554 ;*/
}
ul
.minilabels
{
padding-top
:
.5em
;
list-style-type
:
none
;
font-size
:
75%
;
}
li
.minilabel
{
font-weight
:
bold
;
}
static/js/comex_reg_form_controllers.js
View file @
ddc64b35
...
@@ -382,7 +382,7 @@ function validateSubmit(wholeFormData, doorsResp) {
...
@@ -382,7 +382,7 @@ function validateSubmit(wholeFormData, doorsResp) {
// console.log("actualValue", actualValue)
// console.log("actualValue", actualValue)
// test mandatory -----------------
// test mandatory -----------------
if
(
mandatory
&&
actualValue
==
null
&&
actualValue
!=
""
)
{
if
(
mandatory
&&
(
actualValue
==
null
||
actualValue
==
""
)
)
{
// todo human-readable fieldName here
// todo human-readable fieldName here
missingFields
.
push
(
fieldName
)
missingFields
.
push
(
fieldName
)
valid
=
false
valid
=
false
...
@@ -433,20 +433,16 @@ function validateSubmit(wholeFormData, doorsResp) {
...
@@ -433,20 +433,16 @@ function validateSubmit(wholeFormData, doorsResp) {
else
{
else
{
console
.
warn
(
"form is not valid"
)
console
.
warn
(
"form is not valid"
)
// TODO better user message
// TODO highlight invalid fields
// TODO highlight invalid fields
submitButton
.
disabled
=
false
submitButton
.
disabled
=
false
var
errorMessage
=
""
var
errorMessage
=
''
if
(
missingFields
.
length
)
{
if
(
missingFields
.
length
)
{
errorMessage
+=
"<br/>Please fill the missing fields: "
+
JSON
.
stringify
(
missingFields
)
errorMessage
+=
"Please fill the missing fields: "
+
ulListFromLabelsArray
(
missingFields
,
[
"red"
])
}
// TODO should be handled question by question
if
(
toolongFields
.
length
)
{
errorMessage
+=
"<br/>Please shorten the following fields: "
+
JSON
.
stringify
(
toolongFields
)
}
}
// length is handled by each input's maxlength
// display (TODO setTimeout and fade)
// display (TODO setTimeout and fade)
mainMessage
.
innerHTML
=
errorMessage
mainMessage
.
innerHTML
=
errorMessage
return
false
return
false
...
@@ -456,7 +452,16 @@ function validateSubmit(wholeFormData, doorsResp) {
...
@@ -456,7 +452,16 @@ function validateSubmit(wholeFormData, doorsResp) {
}
}
function
ulListFromLabelsArray
(
strArray
,
ulClassList
)
{
ulClasses
=
[
"minilabels"
].
concat
(
ulClassList
).
join
(
" "
)
var
resultHtml
=
'<ul class="'
+
ulClasses
+
'">'
for
(
var
i
in
strArray
)
{
var
label
=
strArray
[
i
].
replace
(
/_/
,
" "
)
resultHtml
+=
'<li class="minilabel">'
+
label
+
'</li>'
}
resultHtml
+=
'</ul>'
return
resultHtml
}
var
fileInput
=
document
.
getElementById
(
'pic_file'
)
var
fileInput
=
document
.
getElementById
(
'pic_file'
)
...
@@ -620,16 +625,16 @@ var passwords = [pass1, pass2]
...
@@ -620,16 +625,16 @@ var passwords = [pass1, pass2]
// £DEBUG autofill ----------->8------
// £DEBUG autofill ----------->8------
first_name
.
value
=
"Jean"
//
first_name.value = "Jean"
last_name
.
value
=
"Tartampion"
//
last_name.value = "Tartampion"
initialsInput
.
value
=
"JPP"
//
initialsInput.value="JPP"
document
.
getElementById
(
'country'
).
value
=
"France"
//
document.getElementById('country').value = "France"
email
.
value
=
makeRandomString
(
10
)
+
"@om.fr"
//
email.value= makeRandomString(10)+"@om.fr"
pass1
.
value
=
"123456+789"
//
pass1.value="123456+789"
pass2
.
value
=
"123456+789"
//
pass2.value="123456+789"
document
.
getElementById
(
'jobtitle'
).
value
=
"atitle"
//
document.getElementById('jobtitle').value = "atitle"
document
.
getElementById
(
'keywords'
).
value
=
"Blabla"
//
document.getElementById('keywords').value = "Blabla"
document
.
getElementById
(
'institution'
).
value
=
"CNRS"
//
document.getElementById('institution').value = "CNRS"
// --------------------------->8------
// --------------------------->8------
...
...
templates/base_form.html
View file @
ddc64b35
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
<div
class=
"subpage"
id=
"subpage_1"
style=
"display:block"
>
<div
class=
"subpage"
id=
"subpage_1"
style=
"display:block"
>
<!-- NAME & COUNTRY -->
<!-- NAME & COUNTRY -->
<h3
class=
"formcat"
>
Basic infos
</h3>
<h3
class=
"formcat
first
"
>
Basic infos
</h3>
<div
class=
"question input-group"
>
<div
class=
"question input-group"
>
<label
for=
"first_name"
class=
"smlabel input-group-addon"
>
<label
for=
"first_name"
class=
"smlabel input-group-addon"
>
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,7 @@
<div
class=
"subpage"
id=
"subpage_2"
>
<div
class=
"subpage"
id=
"subpage_2"
>
<!-- OTHER PERSONAL INFO -->
<!-- OTHER PERSONAL INFO -->
<h3
class=
"formcat"
>
Complementary information
</h3>
<h3
class=
"formcat
first
"
>
Complementary information
</h3>
<div
class=
"question"
>
<div
class=
"question"
>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
...
@@ -321,9 +321,9 @@
...
@@ -321,9 +321,9 @@
</div>
</div>
<!-- CNIL WARNING -->
<!-- CNIL WARNING -->
<h3
class=
"formcat"
>
About your data
</h3>
<div
class=
"question"
id=
"cnil_warning"
>
<h3
class=
"formcat"
>
About your data
</h3>
<div
class=
"cartouche"
id=
"cnil_warning"
>
<p>
Les informations recueillies à partir de ce formulaire font l’objet d’un traitement
<p>
Les informations recueillies à partir de ce formulaire font l’objet d’un traitement
informatique destiné à:
</p>
informatique destiné à:
</p>
<p><strong>
communityexplorer.org
</strong></p>
<p><strong>
communityexplorer.org
</strong></p>
...
@@ -339,15 +339,11 @@
...
@@ -339,15 +339,11 @@
loi « informatique et libertés » du 6 janvier 1978 modifiée
</a>
,
loi « informatique et libertés » du 6 janvier 1978 modifiée
</a>
,
vous disposez d’un
<a
href=
"https://www.cnil.fr/fr/le-droit-dacces"
>
droit d’accès
</a>
vous disposez d’un
<a
href=
"https://www.cnil.fr/fr/le-droit-dacces"
>
droit d’accès
</a>
et
<a
href=
"https://www.cnil.fr/fr/le-droit-de-rectification"
>
de rectification
</a>
et
<a
href=
"https://www.cnil.fr/fr/le-droit-de-rectification"
>
de rectification
</a>
aux informations qui vous concernent.
aux informations qui vous concernent, en vous adressant à :
</p>
</p>
<p>
Vous pouvez accèder aux informations vous concernant en vous adressant à :
</p>
<p
class=
"rtecenter"
><strong>
todo@iscpif.fr
</strong></p>
<p
class=
"rtecenter"
><strong>
todo@iscpif.fr
</strong></p>
<p>
Vous pouvez également, pour des motifs légitimes,
<p>
Vous pouvez également, pour des motifs légitimes,
<a
href=
"https://www.cnil.fr/fr/le-droit-dopposition"
>
vous opposer au traitement
<a
href=
"https://www.cnil.fr/fr/le-droit-dopposition"
>
vous opposer au traitement
des données vous concernant
</a>
.
des données vous concernant
</a>
. Pour en savoir plus,
<a
href=
"https://www.cnil.fr/fr/comprendre-vos-droits"
>
</p>
<p>
Pour en savoir plus,
<a
href=
"https://www.cnil.fr/fr/comprendre-vos-droits"
>
consultez vos droits sur le site de la CNIL
</a>
.
consultez vos droits sur le site de la CNIL
</a>
.
</p>
</p>
</div>
</div>
...
@@ -377,7 +373,14 @@
...
@@ -377,7 +373,14 @@
<input
id=
"my-captchaHash"
name=
"my-captchaHash"
type=
"text"
hidden
>
<input
id=
"my-captchaHash"
name=
"my-captchaHash"
type=
"text"
hidden
>
</input>
</input>
<div
class=
"row spacerrow"
>
</div><div
class=
"row spacerrow"
>
</div>
<div
class=
"subpage"
id=
"subpage_3"
style=
"display:block"
>
<div
class=
"row spacerrow"
>
</div>
<!-- main validation message -->
<p
id=
"main_validation_message"
class=
"legend"
style=
"display:none"
></p>
<!-- CAPTCHA & SUBMIT BTN + INFOS-->
<!-- CAPTCHA & SUBMIT BTN + INFOS-->
<h3
class=
"formcat"
>
Verify and submit
</h3>
<h3
class=
"formcat"
>
Verify and submit
</h3>
...
@@ -392,8 +395,6 @@
...
@@ -392,8 +395,6 @@
onblur=
"makeBold(this)"
onfocus=
"makeNormal(this)"
>
onblur=
"makeBold(this)"
onfocus=
"makeNormal(this)"
>
</div>
</div>
<div
class=
"row spacerrow"
>
</div>
<!-- == S U B M I T == -->
<!-- == S U B M I T == -->
<!-- button instead of input.submit to validate before real submit action -->
<!-- button instead of input.submit to validate before real submit action -->
<!-- also remember stackoverflow.com/a/3315016/2489184 -->
<!-- also remember stackoverflow.com/a/3315016/2489184 -->
...
@@ -403,10 +404,9 @@
...
@@ -403,10 +404,9 @@
Submit your form
Submit your form
</button>
</button>
<!-- main validation message -->
<p
id=
"main_validation_message"
class=
"legend"
style=
"display:none"
></p>
</form>
</form>
</div>
<!-- FOR DEBUG: test go-between with Doors -->
<!-- FOR DEBUG: test go-between with Doors -->
<!-- <p>
<!-- <p>
...
@@ -425,8 +425,7 @@
...
@@ -425,8 +425,7 @@
<div
class=
"spacer col-sm-2 col-md-2"
>
</div>
<div
class=
"spacer col-sm-2 col-md-2"
>
</div>
</div>
</div>
<div
class=
"row spacerrow"
>
</div>
<div
class=
"row bigspacerrow"
>
</div>
<div
class=
"row spacerrow"
>
</div>
<!-- FOOTER TEXT AND LINKS -->
<!-- FOOTER TEXT AND LINKS -->
<footer>
<footer>
...
...
templates/thank_you.html
View file @
ddc64b35
...
@@ -86,8 +86,7 @@
...
@@ -86,8 +86,7 @@
<p>
{{key}} {{records[key]}}
</p>
<p>
{{key}} {{records[key]}}
</p>
{% endfor %}
{% endfor %}
<h5>
debug message
</h5>
<p
style=
"font-family: monospace; font-weight: bold"
>
<p>
{{message|safe}}
{{message|safe}}
</p>
</p>
</div>
</div>
...
...
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