Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
ec0dddbe
Commit
ec0dddbe
authored
Aug 31, 2015
by
Ad Schellevis
Committed by
Franco Fichtner
Sep 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(mvc) fix is required on TextField
parent
b553b009
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
TextField.php
...nse/mvc/app/models/OPNsense/Base/FieldTypes/TextField.php
+7
-5
No files found.
src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/TextField.php
View file @
ec0dddbe
...
...
@@ -29,6 +29,7 @@
namespace
OPNsense\Base\FieldTypes
;
use
Phalcon\Validation\Validator\Regex
;
use
Phalcon\Validation\Validator\PresenceOf
;
/**
* Class TextField
...
...
@@ -60,16 +61,17 @@ class TextField extends BaseField
*/
public
function
getValidators
()
{
$validators
=
array
()
;
if
(
$this
->
internalValidationMessage
==
null
)
{
$msg
=
"text validation error"
;
}
else
{
$msg
=
$this
->
internalValidationMessage
;
}
if
((
$this
->
internalIsRequired
==
true
||
$this
->
internalValue
!=
null
)
&&
$this
->
internalMask
!=
null
)
{
return
array
(
new
Regex
(
array
(
'message'
=>
$msg
,
'pattern'
=>
trim
(
$this
->
internalMask
))));
}
else
{
// empty field and not required, skip this validation.
return
array
();
if
(
$this
->
internalIsRequired
&&
empty
(
$this
->
internalValue
))
{
$validators
[]
=
new
PresenceOf
(
array
(
'message'
=>
$msg
))
;
}
elseif
(
$this
->
internalValue
!=
null
&&
$this
->
internalMask
!=
null
)
{
$validators
[]
=
array
(
new
Regex
(
array
(
'message'
=>
$msg
,
'pattern'
=>
trim
(
$this
->
internalMask
))));
}
return
$validators
;
}
}
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