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:
Guillaume Lajarige
2016-06-29 08:58:19 +00:00
parent 0ac9e21e5e
commit c44284dc3c
3 changed files with 16 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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
{

View File

@@ -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());
}
}
}