mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Customers portal : Fixed a bug in UserRequest edition form that prevented user to submit. Validation method was returning false on reoslution_code. Fix was to not check validators on empty && none mandatory fields (on both client and server sides).
SVN:trunk[4265]
This commit is contained in:
@@ -893,7 +893,7 @@ table .group-actions .item-action-wrapper .panel-body > p:last-child{
|
||||
border: 1px solid $gray-lighter;
|
||||
}
|
||||
.form_field.has-error div.cke{
|
||||
border: 1px solid $state-danger-border;
|
||||
border: 1px solid $state-danger-text;
|
||||
border-radius: $border-radius-base;
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
|
||||
}
|
||||
|
||||
@@ -142,6 +142,11 @@ $(function()
|
||||
oResult.is_valid = false;
|
||||
oResult.error_messages.push(this.options.validators.mandatory.message);
|
||||
}
|
||||
// ... Field empty but not mandatory, no need to validate
|
||||
else if( bEmpty && !bMandatory )
|
||||
{
|
||||
// It's okay, no need to validate
|
||||
}
|
||||
// ... Otherwise, we check every validators
|
||||
else
|
||||
{
|
||||
|
||||
@@ -393,12 +393,18 @@ abstract class Field
|
||||
{
|
||||
$this->SetValid(true);
|
||||
$this->EmptyErrorMessages();
|
||||
foreach ($this->GetValidators() as $oValidator)
|
||||
|
||||
$bEmpty = ( ($this->GetCurrentValue() === null) || ($this->GetCurrentValue() === '') );
|
||||
|
||||
if (!$bEmpty || $this->GetMandatory())
|
||||
{
|
||||
if (!preg_match($oValidator->GetRegExp(true), $this->GetCurrentValue()))
|
||||
foreach ($this->GetValidators() as $oValidator)
|
||||
{
|
||||
$this->SetValid(false);
|
||||
$this->AddErrorMessage($oValidator->GetErrorMessage());
|
||||
if (!preg_match($oValidator->GetRegExp(true), $this->GetCurrentValue()))
|
||||
{
|
||||
$this->SetValid(false);
|
||||
$this->AddErrorMessage($oValidator->GetErrorMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user