X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/5ef582473f6b329be18ad83c61e053fdcd9c6ed5..a7ba11adfecf6cb906749efe5abce688363aef07:/cf_dropdown_option_edit.php diff --git a/cf_dropdown_option_edit.php b/cf_dropdown_option_edit.php index ddea967b..0f47e184 100644 --- a/cf_dropdown_option_edit.php +++ b/cf_dropdown_option_edit.php @@ -42,30 +42,29 @@ if (false === $cl_name) $errors->add($i18n->getKey('error.db')); $form = new Form('optionEditForm'); -if ($errors->isEmpty()) { +if ($errors->no()) { $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','value'=>$cl_name)); $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id)); $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save'))); -} +} -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); - + // Validate user input. if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name')); - if ($errors->isEmpty()) { + if ($errors->no()) { $res = CustomFields::updateOption($cl_id, $cl_name); if ($res) { // Determine field id for redirect. $field_id = CustomFields::getFieldIdForOption($cl_id); header("Location: cf_dropdown_options.php?field_id=$field_id"); exit(); - } else { + } else $errors->add($i18n->getKey('error.db')); - } } -} +} // POST $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.optionEditForm.name.focus()"');