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
mahara
mahara
Commits
6e6e52ab
Commit
6e6e52ab
authored
Nov 13, 2006
by
Martyn Smith
Committed by
Martyn Smith
Nov 13, 2006
Browse files
Allow element to override required rule
parent
8f0620d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/form/rules/required.php
View file @
6e6e52ab
...
...
@@ -30,10 +30,19 @@ defined('INTERNAL') || die();
* Checks whether the field has been specified.
*
* @param string $field The field to check
* @param array $element The element to check
* @return string The error message, if the value is invalid.
*/
function
form_rule_required
(
$field
)
{
function
form_rule_required
(
$field
,
$element
)
{
// The array test is for using the "required" rule on file elements
$function
=
'form_is_empty_'
.
$element
[
'type'
];
if
(
function_exists
(
$function
))
{
if
(
$function
(
$field
,
$element
))
{
return
get_string
(
'This field is required'
);
}
return
;
}
if
(
$field
==
''
||
is_array
(
$field
)
&&
!
empty
(
$field
[
'error'
]))
{
return
get_string
(
'This field is required'
);
}
...
...
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