diff --git a/include/client/open.inc.php b/include/client/open.inc.php index c5ecb42c66717eadbb5346f7e526e1e4c6ebb1a1..d47e07380273648661a4a2e898d0c4350ddb4e7c 100644 --- a/include/client/open.inc.php +++ b/include/client/open.inc.php @@ -40,14 +40,18 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):$info; </tr> <?php if (!$thisclient) { - UserForm::getUserForm()->render(false, 'Your Information'); + $uform = UserForm::getUserForm()->getForm($_POST); + if ($_POST) $uform->isValid(); + $uform->render(false, 'Your Information'); } else { ?> <tr><td colspan="2"><hr /></td></tr> <tr><td>Email:</td><td><?php echo $thisclient->getEmail(); ?></td></tr> <tr><td>Client:</td><td><?php echo $thisclient->getName(); ?></td></tr> <?php } - TicketForm::getInstance()->render(false); ?> + $tform = TicketForm::getInstance()->getForm($_POST); + if ($_POST) $tform->isValid(); + $tform->render(false); ?> </tbody> <tbody id="dynamic-form"> <?php if ($form) { diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 1c49b407308ba09a9487c4a465e9986a13db9c2f..8d5ce5b554d1133fb59f903cd03ce57a6c69df34 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -222,12 +222,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); </tr> <?php } - TicketForm::getInstance()->render(true); + $tform = TicketForm::getInstance()->getForm($_POST); + if ($_POST) $tform->isValid(); + $tform->render(true); ?> </tbody> <tbody id="dynamic-form"> <?php - if ($form) $form->render(true); + if ($form) $form->getForm()->render(true); ?> </tbody> <tbody> diff --git a/scp/tickets.php b/scp/tickets.php index 32b82768e5dc5b8af09de23b9afa9e4ac689e880..f28ac8e3e31a1677cceede9c867e49e204473b83 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -471,20 +471,11 @@ if($_POST && !$errors): break; case 'open': $ticket=null; - $interest=array('name','email','subject'); if ($topic=Topic::lookup($_POST['topicId'])) { if ($form = DynamicForm::lookup($topic->ht['form_id'])) { $form = $form->instanciate(); - # Collect name, email, and subject address for banning and such - foreach ($form->getAnswers() as $answer) { - $fname = $answer->getField()->get('name'); - if (in_array($fname, $interest)) - # XXX: Assigning to _POST not considered great PHP - # coding style - $_POST[$fname] = $answer->getField()->getClean(); - } - if (!$form->isValid()) - $errors = array_merge($errors, $form->errors()); + if (!$form->getForm()->isValid()) + $errors = array_merge($errors, $form->getForm()->errors()); } } if(!$thisstaff || !$thisstaff->canCreateTickets()) {