RFE 12207 : www_editThingDataSaveViaAjax should return more info if thingdata fails to be saved.

As it is it returns json with an array of error messages: [{error_message=>"some error"},..]
     But to be able to do anything useful with this. eg. highlighting of form fields whose
     input is erroneous we should also return the fieldName.
     This patch takes care of this.
This commit is contained in:
Peter Christiansen 2011-07-28 22:35:18 +02:00
parent 97644dae49
commit 8b9be1e036
2 changed files with 3 additions and 2 deletions

View file

@ -664,7 +664,7 @@ sub editThingDataSave {
}
if ($field->{status} eq "required" && ($fieldValue =~ /^\s$/x || $fieldValue eq "" || !(defined $fieldValue))) {
push (@errors,{
"error_message"=>$field->{label}." ".$i18n->get('is required error').".",
"error_message"=>$field->{label}." ".$i18n->get('is required error').".", "field_name"=>$fieldName,
});
}
if ($field->{status} eq "hidden") {
@ -680,7 +680,7 @@ sub editThingDataSave {
unless ( $self->isUniqueEntry($thingId,$fieldName,$fieldValue,$thingDataId)) {
push (@errors,{
"error_message"=>$field->{label}. $i18n->get('needs to be unique error'),
"error_message"=>$field->{label}. $i18n->get('needs to be unique error'),"field_name"=>$fieldName,
});
}
}