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
typo3
qfq
Commits
bfc03e87
Commit
bfc03e87
authored
May 03, 2016
by
Rafael Ostertag
Browse files
FormGroup.js: added setRequired().
QfqForm.js: support `required` configuration attribute.
parent
8c5525df
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
bfc03e87
/.plantuml
/doc/plantuml
/extension/Documentation/_make/build
/extension/Documentation/_make/build
/qfq.ini
/qfq.ini
/doc/phpdoc
/doc/phpdoc
...
...
javascript/src/Element/FormGroup.js
View file @
bfc03e87
...
@@ -78,10 +78,18 @@ QfqNS.Element = QfqNS.Element || {};
...
@@ -78,10 +78,18 @@ QfqNS.Element = QfqNS.Element || {};
return
$formGroup
;
return
$formGroup
;
};
};
/**
* @public
* @returns {boolean}
*/
n
.
FormGroup
.
prototype
.
hasLabel
=
function
()
{
n
.
FormGroup
.
prototype
.
hasLabel
=
function
()
{
return
this
.
$label
.
length
>
0
;
return
this
.
$label
.
length
>
0
;
};
};
/**
* @public
* @returns {boolean}
*/
n
.
FormGroup
.
prototype
.
hasHelpBlock
=
function
()
{
n
.
FormGroup
.
prototype
.
hasHelpBlock
=
function
()
{
return
this
.
$helpBlock
.
length
>
0
;
return
this
.
$helpBlock
.
length
>
0
;
};
};
...
@@ -92,11 +100,16 @@ QfqNS.Element = QfqNS.Element || {};
...
@@ -92,11 +100,16 @@ QfqNS.Element = QfqNS.Element || {};
* Read-only is mapped onto setEnabled(). We do not distinguish between those two.
* Read-only is mapped onto setEnabled(). We do not distinguish between those two.
*
*
* @param readonly
* @param readonly
* @public
*/
*/
n
.
FormGroup
.
prototype
.
setReadOnly
=
function
(
readonly
)
{
n
.
FormGroup
.
prototype
.
setReadOnly
=
function
(
readonly
)
{
this
.
setEnabled
(
!
readonly
);
this
.
setEnabled
(
!
readonly
);
};
};
/**
* @public
* @param enabled
*/
n
.
FormGroup
.
prototype
.
setEnabled
=
function
(
enabled
)
{
n
.
FormGroup
.
prototype
.
setEnabled
=
function
(
enabled
)
{
this
.
$element
.
prop
(
'
disabled
'
,
!
enabled
);
this
.
$element
.
prop
(
'
disabled
'
,
!
enabled
);
...
@@ -111,6 +124,10 @@ QfqNS.Element = QfqNS.Element || {};
...
@@ -111,6 +124,10 @@ QfqNS.Element = QfqNS.Element || {};
}
}
};
};
/**
* @public
* @param hidden
*/
n
.
FormGroup
.
prototype
.
setHidden
=
function
(
hidden
)
{
n
.
FormGroup
.
prototype
.
setHidden
=
function
(
hidden
)
{
if
(
hidden
)
{
if
(
hidden
)
{
this
.
$formGroup
.
addClass
(
"
hidden
"
);
this
.
$formGroup
.
addClass
(
"
hidden
"
);
...
@@ -119,6 +136,10 @@ QfqNS.Element = QfqNS.Element || {};
...
@@ -119,6 +136,10 @@ QfqNS.Element = QfqNS.Element || {};
}
}
};
};
n
.
FormGroup
.
prototype
.
setRequired
=
function
(
required
)
{
this
.
$element
.
prop
(
'
required
'
,
true
);
};
/**
/**
* Read Only click handler.
* Read Only click handler.
...
...
javascript/src/QfqForm.js
View file @
bfc03e87
...
@@ -106,6 +106,11 @@ var QfqNS = QfqNS || {};
...
@@ -106,6 +106,11 @@ var QfqNS = QfqNS || {};
configuration
.
disabled
=
n
.
Helper
.
stringToBool
(
disabledVal
);
configuration
.
disabled
=
n
.
Helper
.
stringToBool
(
disabledVal
);
}
}
var
requiredVal
=
$element
.
data
(
"
required
"
);
if
(
requiredVal
!==
undefined
)
{
configuration
.
required
=
n
.
Helper
.
stringToBool
(
requiredVal
);
}
configurationArray
.
push
(
configuration
);
configurationArray
.
push
(
configuration
);
}
catch
(
e
)
{
}
catch
(
e
)
{
n
.
Log
.
error
(
e
.
message
);
n
.
Log
.
error
(
e
.
message
);
...
@@ -689,6 +694,10 @@ var QfqNS = QfqNS || {};
...
@@ -689,6 +694,10 @@ var QfqNS = QfqNS || {};
if
(
configurationItem
.
hidden
!==
undefined
)
{
if
(
configurationItem
.
hidden
!==
undefined
)
{
element
.
setHidden
(
configurationItem
.
hidden
);
element
.
setHidden
(
configurationItem
.
hidden
);
}
}
if
(
configurationItem
.
required
!==
undefined
)
{
element
.
setRequired
(
configuration
.
required
);
}
}
catch
(
e
)
{
}
catch
(
e
)
{
n
.
Log
.
error
(
e
.
message
);
n
.
Log
.
error
(
e
.
message
);
}
}
...
...
mockup/elementconfiguration.html
View file @
bfc03e87
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
</div>
</div>
<form
id=
"myForm"
class=
"form-horizontal"
>
<form
id=
"myForm"
class=
"form-horizontal"
data-toggle=
"validator"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-md-2"
>
<div
class=
"col-md-2"
>
...
@@ -174,6 +174,7 @@
...
@@ -174,6 +174,7 @@
<script
src=
"../js/jquery.min.js"
></script>
<script
src=
"../js/jquery.min.js"
></script>
<script
src=
"../js/bootstrap.min.js"
></script>
<script
src=
"../js/bootstrap.min.js"
></script>
<script
src=
"../js/validator.min.js"
></script>
<script
src=
"../js/jqx-all.js"
></script>
<script
src=
"../js/jqx-all.js"
></script>
<script
src=
"../js/EventEmitter.min.js"
></script>
<script
src=
"../js/EventEmitter.min.js"
></script>
<script
src=
"../js/qfq.debug.js"
></script>
<script
src=
"../js/qfq.debug.js"
></script>
...
...
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