LSformElement_select : Added error message on display an unrecognized value

This commit is contained in:
Benjamin Renard 2010-11-15 17:33:47 +01:00
parent 90e471646d
commit a85623dc23
2 changed files with 5 additions and 0 deletions

View file

@ -55,6 +55,7 @@ class LSformElement_select extends LSformElement {
LSsession :: addJSscript('LSformElement_select.js'); LSsession :: addJSscript('LSformElement_select.js');
} }
$params['possible_values'] = $this -> params['text_possible_values']; $params['possible_values'] = $this -> params['text_possible_values'];
$params['unrecognized_value_label_format'] = _("%{value} (unrecognized value)");
$return['html'] = $this -> fetchTemplate(NULL,$params); $return['html'] = $this -> fetchTemplate(NULL,$params);
return $return; return $return;
} }

View file

@ -1,7 +1,11 @@
<ul class='LSform' id='{$attr_name}'> <ul class='LSform' id='{$attr_name}'>
{if $freeze} {if $freeze}
{foreach from=$values item=value} {foreach from=$values item=value}
{if $possible_values.$value}
<li>{$possible_values.$value}</li> <li>{$possible_values.$value}</li>
{else}
<li class='LSform-errors'>{getFData format=$unrecognized_value_label_format data=$value}</li>
{/if}
{foreachelse} {foreachelse}
<li>{$noValueTxt}</li> <li>{$noValueTxt}</li>
{/foreach} {/foreach}