Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
fdfaf635
Commit
fdfaf635
authored
Mar 22, 2016
by
Rafael Ostertag
Browse files
QfqForm.js: QfqForm#applyElementConfiguration() now expects array of objects.
parent
562a1171
Changes
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/QfqForm.js
View file @
fdfaf635
...
...
@@ -459,26 +459,32 @@ if (!QfqNS) {
);
};
/**
*
* @param configuration {array} array of objects.
*/
n
.
QfqForm
.
prototype
.
applyElementConfiguration
=
function
(
configuration
)
{
// key is the name attribute of the Form control.
for
(
var
key
in
configuration
)
{
if
(
!
configuration
.
hasOwnProperty
(
key
))
continue
;
var
arrayLength
=
configuration
.
length
;
for
(
var
i
=
0
;
i
<
arrayLength
;
i
++
)
{
var
configurationItem
=
configuration
[
i
];
var
formElementName
=
configurationItem
[
"
form-element
"
];
if
(
formElementName
===
undefined
)
{
QfqNS
.
Log
.
error
(
"
configuration lacks 'form-element' attribute. Skipping.
"
);
continue
;
}
try
{
var
element
=
n
.
Element
.
getElement
(
key
);
var
formControlConfig
=
configuration
[
key
];
var
element
=
n
.
Element
.
getElement
(
formElementName
);
if
(
formControlConfig
.
value
!==
undefined
)
{
element
.
setValue
(
formControlConfig
.
value
);
if
(
configurationItem
.
value
!==
undefined
)
{
element
.
setValue
(
configurationItem
.
value
);
}
if
(
formControlConfig
.
readonly
!==
undefined
)
{
element
.
setReadOnly
(
formControlConfig
.
readonly
);
if
(
configurationItem
.
readonly
!==
undefined
)
{
element
.
setReadOnly
(
configurationItem
.
readonly
);
}
if
(
formControlConfig
.
disabled
!==
undefined
)
{
element
.
setEnabled
(
!
formControlConfig
.
disabled
);
if
(
configurationItem
.
disabled
!==
undefined
)
{
element
.
setEnabled
(
!
configurationItem
.
disabled
);
}
}
catch
(
e
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment