function showResults(Dto_FormResult $result, array $data = null) { /* * First make sure the user actually tried * to submit this form, if so, return our * JSON output and nothing else. */ if ($result->isSubmitted()) { /* * Determine what type of renderer for the form submission * result we should use? * * We render either as HTML, if not default to render * as JSON */ if (isset($data['renderhtml'])) { renderResultMessagesHtml($result); } else { echo $result->toJSON(); } # else return true; } # if /* * If there was no submit of the form, just show placeholders * for the errors and information */ echo "<ul class='formerrors'></ul><ul class='forminformation'></ul>"; return false; }