我正在创建调查问题,因为创建问题我有一个php类,基于问题类型,该类返回问题和选项。我正面临复杂的困境。
我的创建类功能复选框如下:
private void handleZoom(MotionEvent event, Camera.Parameters params) {
int maxZoom = params.getMaxZoom();
int zoom = params.getZoom();
Log.d(LOG_TAG, "maxZoom "+maxZoom);
Log.d(LOG_TAG, "zoom "+zoom);
float newDist = getFingerSpacing(event);
if (newDist > mDist) {
Log.d(LOG_TAG, "handleZoom 1");
// zoom in
if (zoom < maxZoom)
zoom++;
} else if (newDist < mDist) {
Log.d(LOG_TAG, "handleZoom 2");
// zoom out
if (zoom > 0)
zoom--;
}
mDist = newDist;
params.setZoom(zoom);
Log.d(LOG_TAG, "handleZoom 3 "+zoom);
mCamera.setParameters(params);
}
当我收到以下复选框时,
protected function QuestionTypeCheckbox(){
$CheckBoxAnswer=$this->getAnswerByQuestionId();
$rowscheckbox=$this->getOptions();
if($rowscheckbox==TRUE){
$optioncheckbox=NULL;
foreach ($rowscheckbox as $row) {
if(in_array($row->option_order, (explode(',', $CheckBoxAnswer))))
{
$selected= true;
//$check = 'checked';
} else{
$selected=0;
//$check = '';
}
$optioncheckbox= $optioncheckbox.
"<label class='checkbox-inline'><input type='checkbox' ng-checked='$selected' ng-true-value='$row->option_order' ng-model='question_$this->Qid".".Value$row->option_order' name=".""."question_$this->Qid[]".""." value='$row->option_order'>$row->option</label>";
}
return $optioncheckbox;
}
else {return "FALSE";}
}
返回复选框后,其工作正常。它显示带有检查值的值。 但问题是当我提交表单然后返回null值。但如果我取消选择并再次选择复选框,则返回其返回值。
<div class="form-group">
<label >3.Water supply<br></label><br><label class='checkbox-inline'>
<input type='checkbox' ng-checked='1' ng-true-value='1' ng-model='question_4.Value1' name=question_4[] value='1'>TubeWell</label>
<label class='checkbox-inline'><input type='checkbox' ng-checked='0' ng-true-value='2' ng-model='question_4.Value2' name=question_4[] value='2'>Pond</label>
<label class='checkbox-inline'><input type='checkbox' ng-checked='0' ng-true-value='3' ng-model='question_4.Value3' name=question_4[] value='3'>River</label>
<label class='checkbox-inline'><input type='checkbox' ng-checked='1' ng-true-value='4' ng-model='question_4.Value4' name=question_4[] value='4'>Canel</label> </div>
</div>