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
6588da7d
Commit
6588da7d
authored
Apr 09, 2020
by
Théo GUILLON
Browse files
Correction : enregistrement de valeur par défault
Correction : affichage des valeurs par default
parent
a67c9d1b
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/View/Elements/Formulaires/champDuFormulaire.ctp
View file @
6588da7d
...
...
@@ -124,16 +124,18 @@ foreach ($champs as $key => $value) {
.
'<div class="col-md-8 contentCheckbox">'
.
'<input id="'
.
$details
[
'name'
]
.
'" type="hidden" name="'
.
$details
[
'name'
]
.
'" value="">'
;
foreach
(
$details
[
'options'
]
as
$key
=>
$val
)
{
$checkbox_id
=
$details
[
'name'
]
.
$key
;
$checked
=
""
;
if
(
isset
(
$details
[
'default'
]))
{
if
(
in_array
(
$
details
[
'name'
]
.
$
key
,
$details
[
'default'
]))
{
if
(
in_array
(
$key
,
$details
[
'default'
]))
{
$checked
=
"checked"
;
}
}
echo
'<div class="checkbox">'
.
'<input id="'
.
$
details
[
'name'
]
.
$key
.
'" class="champNomVariableReadonly" type="checkbox" '
.
$checked
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$
val
.
'">'
.
'<label for="'
.
$
details
[
'name'
]
.
$key
.
'">'
.
'<input id="'
.
$
checkbox_id
.
'" class="champNomVariableReadonly" type="checkbox" '
.
$checked
.
' name="'
.
$details
[
'name'
]
.
'" value="'
.
$
key
.
'">'
.
'<label for="'
.
$
checkbox_id
.
'">'
.
$val
.
'</label>'
.
'</div>'
;
...
...
@@ -160,7 +162,7 @@ foreach ($champs as $key => $value) {
foreach
(
$details
[
'options'
]
as
$key
=>
$val
)
{
$checked
=
""
;
if
(
isset
(
$details
[
'default'
]))
{
if
(
$details
[
'default'
]
===
$
details
[
'name'
]
.
$key
)
{
if
(
$details
[
'default'
]
===
$
val
)
{
$checked
=
"checked"
;
}
}
...
...
@@ -191,7 +193,7 @@ foreach ($champs as $key => $value) {
foreach
(
$details
[
'options'
]
as
$key
=>
$val
)
{
$selected
=
""
;
if
(
isset
(
$details
[
'default'
]))
{
if
(
$details
[
'default'
]
==
=
$details
[
'name'
]
.
$key
)
{
if
(
$details
[
'default'
]
==
$key
)
{
$selected
=
"selected"
;
}
}
...
...
@@ -219,7 +221,7 @@ foreach ($champs as $key => $value) {
foreach
(
$details
[
'options'
]
as
$key
=>
$val
)
{
$selected
=
""
;
if
(
isset
(
$details
[
'default'
]))
{
if
(
in_array
(
$
details
[
'name'
]
.
$
key
,
$details
[
'default'
]))
{
if
(
in_array
(
$key
,
$details
[
'default'
]))
{
$selected
=
'selected'
;
}
}
...
...
app/View/Elements/Formulaires/modal/modalAddCondition.ctp
View file @
6588da7d
...
...
@@ -190,7 +190,12 @@
});
} else {
$(idContainer).find('input[name ="'+idFieldConditionCreated+'"], option[name ="'+idFieldConditionCreated+'"]').each(function () {
var option = $(this).attr('value');
if ($(this).attr('type') == 'checkbox') {
var option = $(this).next('label').text();
} else {
var option = $(this).attr('value');
}
var id = $(this).attr('id');
if (option && id) {
...
...
app/webroot/js/FormulaireGenerator/createFormulaire.js
View file @
6588da7d
...
...
@@ -551,6 +551,14 @@ var createForm = function(typeCreateForm) {
idListeDesValeurs
=
'
option-checkbox
'
;
classListeValeur
=
'
checkboxForm
'
;
$
(
idContainer
).
find
(
'
.ui-selected
'
).
find
(
findType
).
each
(
function
()
{
if
(
list
===
''
)
{
list
=
list
+
$
(
this
).
next
(
'
label
'
).
text
();
}
else
{
list
=
list
+
'
\n
'
+
$
(
this
).
next
(
'
label
'
).
text
();
}
});
}
else
if
(
object
.
hasClass
(
'
radios
'
))
{
champId
=
'
name-radios-
'
+
typeCreateForm
;
...
...
@@ -566,15 +574,15 @@ var createForm = function(typeCreateForm) {
'
Champ obligatoire
'
+
'
</label>
'
+
'
</div>
'
;
}
$
(
idContainer
).
find
(
'
.ui-selected
'
).
find
(
findType
).
each
(
function
()
{
if
(
list
===
''
)
{
list
=
list
+
$
(
this
).
val
();
}
else
{
list
=
list
+
'
\n
'
+
$
(
this
).
val
();
}
});
$
(
idContainer
).
find
(
'
.ui-selected
'
).
find
(
findType
).
each
(
function
()
{
if
(
list
===
''
)
{
list
=
list
+
$
(
this
).
val
();
}
else
{
list
=
list
+
'
\n
'
+
$
(
this
).
val
();
}
});
}
}
if
(
object
.
is
(
'
.deroulant, .multi-select
'
))
{
...
...
@@ -1178,7 +1186,7 @@ var createForm = function(typeCreateForm) {
objet
=
objet
+
'
<input id="
'
+
newNameField
+
'
" type="hidden" name="
'
+
newNameField
+
'
" value="">
'
$
.
each
(
newOptionsField
,
function
(
index
,
value
)
{
objet
=
objet
+
'
<div class="checkbox">
'
+
'
<input id="
'
+
newNameField
+
index
+
'
" type="checkbox" name="
'
+
newNameField
+
'
" value="
'
+
value
+
'
">
'
+
'
<input id="
'
+
newNameField
+
index
+
'
" type="checkbox" name="
'
+
newNameField
+
'
" value="
'
+
index
+
'
">
'
+
'
<label for="
'
+
newNameField
+
index
+
'
">
'
+
value
+
'
</label>
'
+
...
...
app/webroot/js/FormulaireGenerator/saveFieldsFormulaire.js
View file @
6588da7d
...
...
@@ -100,13 +100,15 @@ $(document).ready(function () {
options
=
[];
$
(
draggable
).
find
(
'
input[type="checkbox"]
'
).
each
(
function
()
{
options
.
push
(
$
(
this
).
attr
(
'
value
'
));
// options.push($(this).attr('value'));
options
.
push
(
$
(
this
).
next
(
'
label
'
).
text
());
});
objFieldDetails
[
'
options
'
]
=
options
;
var
valuesCheckboxesDefault
=
[];
$
(
'
input[name="
'
+
fieldNameCheckboxes
+
'
"]:checked
'
).
each
(
function
(
key
,
value
)
{
valuesCheckboxesDefault
.
push
(
this
.
id
);
// valuesCheckboxesDefault.push(this.id);
valuesCheckboxesDefault
.
push
(
this
.
value
);
});
objFieldDetails
[
'
default
'
]
=
valuesCheckboxesDefault
;
...
...
@@ -133,7 +135,8 @@ $(document).ready(function () {
var
valuesRadiosDefault
=
''
;
$
(
'
input[name="
'
+
fieldNameRadios
+
'
"]:checked
'
).
each
(
function
()
{
if
(
this
.
value
!=
''
)
{
valuesRadiosDefault
=
this
.
id
;
// valuesRadiosDefault = this.id;
valuesRadiosDefault
=
this
.
value
;
}
});
objFieldDetails
[
'
default
'
]
=
valuesRadiosDefault
;
...
...
@@ -162,7 +165,8 @@ $(document).ready(function () {
var
valuesDeroulantDefault
=
''
;
$
(
'
option[name="
'
+
fieldNameDeroulant
+
'
"]:checked
'
).
each
(
function
()
{
if
(
this
.
value
!=
''
)
{
valuesDeroulantDefault
=
this
.
id
;
// valuesDeroulantDefault = this.id;
valuesDeroulantDefault
=
this
.
value
;
}
});
objFieldDetails
[
'
default
'
]
=
valuesDeroulantDefault
;
...
...
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