diff --git a/js/form_field.js b/js/form_field.js
index 61bb61c6c..97572b612 100644
--- a/js/form_field.js
+++ b/js/form_field.js
@@ -122,7 +122,6 @@ $(function()
// Doing data validation
if(this.options.validators !== null)
{
- var bMandatory = (this.options.validators.mandatory !== undefined);
// Extracting value for the field
var oValue = this.element.triggerHandler('get_current_value');
if(oValue === null)
@@ -130,19 +129,22 @@ $(function()
console.log('Form field : Warning, there was no value for "'+this.element.attr('data-field-id')+'"');
return oResult;
}
- var aValueKeys = Object.keys(oValue);
+
+ var bMandatory = (this.options.validators.mandatory !== undefined);
+ var bEmpty = ($.isArray(oValue)) ? (oValue.length === 0) : (oValue === '' || oValue === undefined);
+ var value = oValue;
// This is just a safety check in case a field doesn't always return an object when no value assigned, so we have to check the mandatory validator here...
// ... But this should never happen.
- if( (aValueKeys.length === 0) && bMandatory )
+ //if( (aValueKeys.length === 0) && bMandatory )
+ if( bEmpty && bMandatory )
{
oResult.is_valid = false;
oResult.error_messages.push(this.options.validators.mandatory.message);
}
// ... Otherwise, we check every validators
- else if(aValueKeys.length > 0)
+ else
{
- var value = oValue[aValueKeys[0]];
for(var sValidatorType in this.options.validators)
{
var oValidator = this.options.validators[sValidatorType];
@@ -186,7 +188,7 @@ $(function()
}
}
else if($.isArray(value))
- {
+ {
for(var i in value)
{
if(value[i] === 'string' && !oRegExp.test(value))
diff --git a/sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php b/sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php
index 23046761e..5034b5d26 100644
--- a/sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php
+++ b/sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php
@@ -86,7 +86,7 @@ EOF
// Rendering table widget
// - Vars
- $sEmptyTableLabel = htmlentities(Dict::S('UI:Message:EmptyList:UseAdd'), ENT_QUOTES, 'UTF-8');
+ $sEmptyTableLabel = htmlentities(Dict::S( ($this->oField->GetReadOnly()) ? 'Portal:Datatables:Language:EmptyTable' : 'UI:Message:EmptyList:UseAdd'), ENT_QUOTES, 'UTF-8');
$sSelectionOptionHtml = ($this->oField->GetReadOnly()) ? 'false' : '{"style": "multi"}';
$sSelectionInputHtml = ($this->oField->GetReadOnly()) ? '' : '';
// - Output
diff --git a/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php b/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php
index a72de9343..2757cd240 100644
--- a/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php
+++ b/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php
@@ -166,7 +166,7 @@ EOF
{
// Note : The test is a double equal on purpose as the type of the value received from the XHR is not always the same as the type of the allowed values. (eg : string vs int)
$sSelectedAtt = ($this->oField->GetCurrentValue() == $sChoice) ? 'selected' : '';
- $oOutput->AddHtml('');
+ $oOutput->AddHtml('');
}
$oOutput->AddHtml('');
$oOutput->AddHtml('');