我有一个表格,学生可以在其中输入他们的科目结果。现在,如果在科目列表中,英语不及格,即(D,E),或者没有输入,他们不能被引导到下一页。
我的控制器在保存之前收到如下数据
for ($i = 1; $i < sizeof($this->data['ApplicantOlevelQualification']['olevel_subject_code']); $i++) {
if ($this->data['ApplicantOlevelQualification']['olevel_subject_code'][$i] != "") {
$this->ApplicantOlevelQualification->create();
$this->ApplicantOlevelQualification->id = null;
$this->ApplicantOlevelQualification->set(array(
'applicants_detail_id' => $app_id,
'olevel_subject_code' => $this->data['ApplicantOlevelQualification']['olevel_subject_code'][$i],
'grade' => $this->data['ApplicantOlevelQualification']['grade'][$i],
'centre_number'=> $centre_number,
'candidate_number'=> $candidate_number,
'exam_body_code'=> $exam_body_code,
'year_written'=> $year_written,
)
);
之后我的保存是
if ($this->ApplicantOlevelQualification->save()) {
$this->Session->setFlash(__('Your O\'level Qualifications have been saved'));
} else {
$this->Session->setFlash(__('Your O\'level Qualifications failed to save.'));
}
}
所以伙计们,我的英语有
'olevel_subject_code' = 8900,
我只想要英语成绩为 A、B、C 的学生
'grade'=A,B or C
要保存并继续,其余的必须保留在该视图上。我的模型名称是申请人OlevelQualification,我不知道具体在哪里以及如何进行验证。提前感谢您的帮助