Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libriciel
web-DPO
Commits
0e902f41
Commit
0e902f41
authored
Apr 01, 2020
by
Théo GUILLON
Browse files
Correction : de l'enregistrement des valeurs par défault des champs
parent
d7033d45
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/View/Elements/Formulaires/champDuFormulaire.ctp
View file @
0e902f41
...
...
@@ -20,8 +20,10 @@ foreach ($champs as $key => $value) {
// Champ obligatoire ou non
if
(
$details
[
'obligatoire'
]
==
true
)
{
$champObligatoire
=
"fieldRequired"
;
$test
=
true
;
}
else
{
$champObligatoire
=
"fieldNotRequired"
;
$test
=
false
;
}
if
(
$details
[
'repeat'
]
==
true
)
{
...
...
@@ -115,7 +117,7 @@ foreach ($champs as $key => $value) {
}
echo
'<div class="checkbox">'
.
'<input id="'
.
$key
.
'" class="champNomVariableReadonly" type="checkbox" '
.
$checked
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$val
.
'"
id="x'
.
$key
.
'"
><label for="x'
.
$key
.
'">'
.
$val
.
'</label></div>'
;
.
'<input id="'
.
$key
.
'" class="champNomVariableReadonly" type="checkbox" '
.
$checked
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$val
.
'"><label for="x'
.
$key
.
'">'
.
$val
.
'</label></div>'
;
}
echo
'</div>
</div>
...
...
@@ -133,7 +135,7 @@ foreach ($champs as $key => $value) {
.
'</label>'
.
'</div>'
.
'<div class="col-md-8 contentRadio">'
;
foreach
(
$details
[
'options'
]
as
$val
)
{
foreach
(
$details
[
'options'
]
as
$key
=>
$val
)
{
$checked
=
""
;
if
(
isset
(
$details
[
'default'
]))
{
if
(
$val
===
$details
[
'default'
])
{
...
...
@@ -141,7 +143,8 @@ foreach ($champs as $key => $value) {
}
}
echo
'<div class="radio"><input class="champNomVariableReadonly" type="radio" '
.
$checked
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$val
.
'">'
.
$val
.
'</div>'
;
echo
'<div class="radio">'
.
'<input id="'
.
$key
.
'" class="champNomVariableReadonly" type="radio" '
.
$checked
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$val
.
'">'
.
$val
.
'</div>'
;
}
echo
'</div></div>'
;
break
;
...
...
@@ -161,8 +164,8 @@ foreach ($champs as $key => $value) {
foreach
(
$details
[
'options'
]
as
$key
=>
$val
)
{
$selected
=
""
;
if
(
isset
(
$details
[
'default'
]))
{
if
(
in_array
(
$key
,
$details
[
'default'
])
)
{
$selected
=
'
selected
'
;
if
(
$val
===
$details
[
'default'
])
{
$selected
=
" result-
selected
"
;
}
}
...
...
@@ -192,7 +195,7 @@ foreach ($champs as $key => $value) {
}
}
echo
'<option class="champNomVariableReadonly" '
.
$selected
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$val
.
'"> '
.
$val
.
'</option>'
;
echo
'<option
id="'
.
$key
.
'"
class="champNomVariableReadonly" '
.
$selected
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$val
.
'"> '
.
$val
.
'</option>'
;
}
echo
'</select>'
.
'</div>'
...
...
app/webroot/js/FormulaireGenerator/createFormulaire.js
View file @
0e902f41
...
...
@@ -257,8 +257,8 @@ var createForm = function(typeCreateForm) {
'
</label>
'
+
'
</div>
'
+
'
<div class="col-md-8">
'
+
'
<select class="form-control contentDeroulant">
'
+
'
<option>Aucune option sélectionnée</option>
'
+
'
<select class="
transformSelect
form-control contentDeroulant"
data-placeholder=" "
>
'
+
'
<option
value=""
>Aucune option sélectionnée</option>
'
+
'
</select>
'
+
'
</div>
'
+
'
</div>
'
...
...
@@ -799,7 +799,7 @@ var createForm = function(typeCreateForm) {
if
(
$
(
this
).
hasClass
(
'
checkboxes
'
))
{
$
.
each
(
newOptionsField
,
function
(
index
,
value
)
{
objet
=
objet
+
'
<div class="checkbox">
'
+
'
<input type="checkbox" name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
'
<input
id="
'
+
index
+
'
"
type="checkbox" name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
'
<label>
'
+
value
+
'
</label>
'
+
...
...
@@ -814,7 +814,7 @@ var createForm = function(typeCreateForm) {
if
(
$
(
this
).
hasClass
(
'
radios
'
))
{
$
.
each
(
newOptionsField
,
function
(
index
,
value
)
{
objet
=
objet
+
'
<div class="radio">
'
+
'
<input type="radio" name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
'
<input
id="
'
+
index
+
'
"
type="radio" name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
value
+
'
</div>
'
;
});
...
...
@@ -826,7 +826,7 @@ var createForm = function(typeCreateForm) {
// Attribution les valeurs au champ "Menu déroulant"
if
(
$
(
this
).
hasClass
(
'
deroulant
'
))
{
$
.
each
(
newOptionsField
,
function
(
index
,
value
)
{
objet
=
objet
+
'
<option name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
objet
=
objet
+
'
<option
id="
'
+
index
+
'
"
name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
value
+
'
</option>
'
;
});
...
...
@@ -838,7 +838,7 @@ var createForm = function(typeCreateForm) {
// Attribution les valeurs au champ "Menu multi-sélect"
if
(
$
(
this
).
hasClass
(
'
multi-select
'
))
{
$
.
each
(
newOptionsField
,
function
(
index
,
value
)
{
objet
=
objet
+
'
<option name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
objet
=
objet
+
'
<option
id="
'
+
index
+
'
"
name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
value
+
'
</option>
'
;
});
...
...
app/webroot/js/FormulaireGenerator/saveFieldsFormulaire.js
View file @
0e902f41
...
...
@@ -94,7 +94,8 @@ $(document).ready(function () {
fieldType
=
'
checkboxes
'
;
objFieldDetails
[
'
name
'
]
=
$
(
draggable
).
find
(
'
input
'
).
attr
(
'
name
'
);
var
fieldNameCheckboxes
=
$
(
draggable
).
find
(
'
input
'
).
attr
(
'
name
'
);
objFieldDetails
[
'
name
'
]
=
fieldNameCheckboxes
;
objFieldDetails
[
'
label
'
]
=
$
(
draggable
).
find
(
'
.labeler
'
).
html
();
options
=
[];
...
...
@@ -104,7 +105,7 @@ $(document).ready(function () {
objFieldDetails
[
'
options
'
]
=
options
;
var
valuesCheckboxesDefault
=
[];
$
(
'
input[name="
'
+
fieldName
+
'
"]:checked
'
).
each
(
function
()
{
$
(
'
input[name="
'
+
fieldName
Checkboxes
+
'
"]:checked
'
).
each
(
function
(
key
,
value
)
{
valuesCheckboxesDefault
.
push
(
this
.
id
);
});
objFieldDetails
[
'
default
'
]
=
valuesCheckboxesDefault
;
...
...
@@ -118,7 +119,8 @@ $(document).ready(function () {
fieldType
=
'
radios
'
;
objFieldDetails
[
'
name
'
]
=
$
(
draggable
).
find
(
'
input
'
).
attr
(
'
name
'
);
var
fieldNameRadios
=
$
(
draggable
).
find
(
'
input
'
).
attr
(
'
name
'
);
objFieldDetails
[
'
name
'
]
=
fieldNameRadios
;
objFieldDetails
[
'
label
'
]
=
$
(
draggable
).
find
(
'
.labeler
'
).
html
();
objFieldDetails
[
'
default
'
]
=
$
(
draggable
).
find
(
'
input[name="
'
+
fieldName
+
'
"]:checked
'
).
val
();
...
...
@@ -128,6 +130,14 @@ $(document).ready(function () {
});
objFieldDetails
[
'
options
'
]
=
options
;
var
valuesRadiosDefault
=
''
;
$
(
'
input[name="
'
+
fieldNameRadios
+
'
"]:checked
'
).
each
(
function
()
{
if
(
this
.
value
!=
''
)
{
valuesRadiosDefault
=
this
.
id
;
}
});
objFieldDetails
[
'
default
'
]
=
valuesRadiosDefault
;
}
else
if
(
$
(
draggable
).
hasClass
(
'
deroulant
'
))
{
if
(
typeof
$
(
draggable
).
find
(
'
option
'
).
attr
(
'
name
'
)
===
''
||
typeof
$
(
draggable
).
find
(
'
option
'
).
attr
(
'
name
'
)
===
'
undefined
'
)
{
alert
(
'
Le nom de variable du menu déroulant est incorrect
'
);
...
...
@@ -137,7 +147,8 @@ $(document).ready(function () {
fieldType
=
'
deroulant
'
;
objFieldDetails
[
'
name
'
]
=
$
(
draggable
).
find
(
'
option
'
).
attr
(
'
name
'
);
var
fieldNameDeroulant
=
$
(
draggable
).
find
(
'
option
'
).
attr
(
'
name
'
);
objFieldDetails
[
'
name
'
]
=
fieldNameDeroulant
;
objFieldDetails
[
'
label
'
]
=
$
(
draggable
).
find
(
'
.labeler
'
).
html
();
options
=
[];
...
...
@@ -149,8 +160,8 @@ $(document).ready(function () {
objFieldDetails
[
'
options
'
]
=
options
;
var
valuesDeroulantDefault
=
''
;
$
(
'
option[name="
'
+
fieldName
+
'
"]:checked
'
).
each
(
function
()
{
if
(
this
.
value
!=
''
)
{
$
(
'
option[name="
'
+
fieldName
Deroulant
+
'
"]:checked
'
).
each
(
function
()
{
if
(
this
.
value
!=
''
)
{
valuesDeroulantDefault
=
this
.
id
;
}
});
...
...
@@ -165,7 +176,8 @@ $(document).ready(function () {
fieldType
=
'
multi-select
'
;
objFieldDetails
[
'
name
'
]
=
$
(
draggable
).
find
(
'
option
'
).
attr
(
'
name
'
);
var
fieldNameMultiSelect
=
$
(
draggable
).
find
(
'
option
'
).
attr
(
'
name
'
);
objFieldDetails
[
'
name
'
]
=
fieldNameMultiSelect
;
objFieldDetails
[
'
label
'
]
=
$
(
draggable
).
find
(
'
.labeler
'
).
html
();
options
=
[];
...
...
@@ -175,7 +187,7 @@ $(document).ready(function () {
objFieldDetails
[
'
options
'
]
=
options
;
var
valuesMultiSelectDefault
=
[];
$
(
'
option[name="
'
+
fieldName
+
'
"]:checked
'
).
each
(
function
()
{
$
(
'
option[name="
'
+
fieldName
MultiSelect
+
'
"]:checked
'
).
each
(
function
()
{
valuesMultiSelectDefault
.
push
(
this
.
index
);
});
objFieldDetails
[
'
default
'
]
=
valuesMultiSelectDefault
;
...
...
Write
Preview
Supports
Markdown
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