mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
Add custom message for form's regex validation
This commit is contained in:
parent
94f5bd75ac
commit
174abea6bd
2 changed files with 24 additions and 10 deletions
|
|
@ -23,12 +23,19 @@ class BpConfigForm extends BpConfigBaseForm
|
|||
'max' => 40
|
||||
)
|
||||
),
|
||||
array(
|
||||
[
|
||||
'validator' => 'Regex',
|
||||
'options' => array(
|
||||
'pattern' => '/^[a-zA-Z0-9](?:[a-zA-Z0-9 ._-]*)?[a-zA-Z0-9_]$/'
|
||||
)
|
||||
)
|
||||
'options' => [
|
||||
'pattern' => '/^[a-zA-Z0-9](?:[\w\h._-]*)?\w$/',
|
||||
'messages' => [
|
||||
'regexNotMatch' => $this->translate(
|
||||
'Id must only consist of alphanumeric characters.'
|
||||
. ' Underscore at the beginning and space, dot and hyphen at the beginning'
|
||||
. ' and end are not allowed.'
|
||||
)
|
||||
]
|
||||
]
|
||||
]
|
||||
),
|
||||
'description' => $this->translate(
|
||||
'This is the unique identifier of this process'
|
||||
|
|
|
|||
|
|
@ -49,12 +49,19 @@ class BpUploadForm extends BpConfigBaseForm
|
|||
'max' => 40
|
||||
)
|
||||
),
|
||||
array(
|
||||
[
|
||||
'validator' => 'Regex',
|
||||
'options' => array(
|
||||
'pattern' => '/^[a-zA-Z0-9](?:[a-zA-Z0-9 ._-]*)?[a-zA-Z0-9_]$/'
|
||||
)
|
||||
)
|
||||
'options' => [
|
||||
'pattern' => '/^[a-zA-Z0-9](?:[\w\h._-]*)?\w$/',
|
||||
'messages' => [
|
||||
'regexNotMatch' => $this->translate(
|
||||
'Id must only consist of alphanumeric characters.'
|
||||
. ' Underscore at the beginning and space, dot and hyphen at the beginning'
|
||||
. ' and end are not allowed.'
|
||||
)
|
||||
]
|
||||
]
|
||||
]
|
||||
),
|
||||
));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue