Ah, yes... small bug. Caught out by php’s loose handling of what’s true or false.. the value 0 is evaluated as false in the form parser and therefore not added to the value list.
You’ll need to make a change in eform.inc.php line 738 (eform 1.4.3).
In the eFormParseTemplate function change this line:
// if($value) $validValues[] = $value;
to:
if( trim($value)!='' ) $validValues[] = $value;
Here it is again in context...
<?php
case "select":
//replace with 'cleaned' tag and added placeholder
$newTag = buildTagPlaceholder('select',$tagAttributes,$name);
$tpl = str_replace($fieldTags[$i],$newTag,$tpl);
if($formats[$name]) $formats[$name][2]='listbox';
//Get the whole select block with option tags
$regExp = "#<select .*?name=".$tagAttributes['name']."[^>]*?".">(.*?)</select>#si";
preg_match($regExp,$tpl,$matches);
$optionTags = $matches[1];
$select = $newSelect = $matches[0];
//get separate option tags and split them up
preg_match_all("#(<option [^>]*?".">)#si",$optionTags,$matches); //adjusted so it doesn't mess up syntax coloring
$validValues = array();
foreach($matches[1] as $option){
$attr = attr2array($option);
$value = substr($attr['value'],1,-1); //strip outer quotes
//change this line
// if($value) $validValues[] = $value;
//to this
if( trim($value)!='' ) $validValues[] = $value;
//--
$newTag = buildTagPlaceholder('option',$attr,$name);
$newSelect = str_replace($option,$newTag,$newSelect);
}
//replace complete select block
$tpl = str_replace($select,$newSelect,$tpl);
//add valid values to formats... (extension to $formats)
if($formats[$name] && !$formats[$name][5])
$formats[$name][4] = $_lang['ef_failed_default'];
//convert commas in values to something else !
$formats[$name][5]= "#LIST " . implode(",",str_replace(',',',',$validValues));
break;
?>