name_prefix."unit\"";
$nameanswer = "name=\"".$question->name_prefix."answer\"";
//if left unit is placed before answer so we need to answer field text and a center pice for the show units options
// split the respnse in 2 element numerical and units
/*if (!empty($question->options->showunits)){
if(isset($question->options->units) && count($question->options->units)){
$length = 0;
$goodkey = 0 ;
foreach ($question->options->units as $key => $unit){
if (false === stripos($value, $unit->unit)){
}else{
if(strlen($unit->unit)> $length) {$length =strlen($unit->unit);
$goodkey = $key ;
}
}
}
if($length){
$value = str_replace($question->options->units[$goodkey]->unit, '' , $value);
}
$state->responses['unit']=$goodkey ;
}
}*/
if (isset($state->responses['answer']) && $state->responses['answer']!='') {
$valueanswer = ' value="'.s($state->responses['answer']).'" ';
} else {
$valueanswer = ' value="" ';
}
if (isset($state->responses['unit']) && $state->responses['unit']!='') {
$valueunit = ' value="'.s($state->responses['unit']).'" ';
} else {
$valueunit = ' value="" ';
if ($question->options->showunits == 2 ){
$valueunit = ' value="'.s($question->options->units[0]->unit).'" ';
}
}
// put a div to enclose the answer and unit elements
$textlength = 20 ;
?>
options->unitsleft == 0 ){ ?>
feedback){
$classunit = question_get_feedback_class(1-$this->raw_unitpenalty);
$feedbackimgunit = question_get_feedback_image(1-$this->raw_unitpenalty, $options->feedback);
}
if ($question->options->showunits == 3 || (isset($question->options->units) && count($question->options->units) == 0 )) {// no unit display or tested
?>
value ="" />
options->showunits == 0 ) {// display unit text input
?>