$hide_form = FALSE;
             #tdomf_fixslashesargs();
         }
         $message .= "</div>";
     } else {
         $message = "<div class=\"tdomf_form_message\" id=\"tdomf_form" . $form_tag . "_message\" name=\"tdomf_form" . $form_tag . "_message\">" . $message . "</div>";
         $save_post_info = TRUE;
         $hide_form = false;
         #tdomf_fixslashesargs();
     }
 } else {
     if (isset($_POST['tdomf_form' . $form_tag . '_preview'])) {
         #tdomf_fixslashesargs();
         $save_post_info = TRUE;
         $hide_form = false;
         $message = tdomf_validate_form($_POST, true);
         if ($message == NULL) {
             $message = "<div class=\"tdomf_form_preview\" id=\"tdomf_form" . $form_tag . "_message\" name=\"tdomf_form" . $form_tag . "_message\">";
             $message .= tdomf_preview_form($_POST);
             $message .= "</div>";
         } else {
             $message = "<div class=\"tdomf_form_message\" id=\"tdomf_form" . $form_tag . "_message\" name=\"tdomf_form" . $form_tag . "_message\">" . $message . "</div>";
         }
         // allows the final check to work when editing
         //
         unset($post_id);
     } else {
         if (isset($_POST['tdomf_form' . $form_tag . '_clear'])) {
             $message = NULL;
             $save_post_info = false;
             $hide_form = false;
                            // Future versions of TDOMF will provide this as an option.
                            //
                            #die( "tdomfRedirect$form_tag('http://thedeadone.net/download/tdo-mini-forms-wordpress-plugin/');" );
                        }
                    }
                }
            }
            // If retVal is a string, something went wrong!
        } else {
            tdomf_ajax_exit($form_id, tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_ERROR, $form_id, false, false, $retVal), false, false, $post_id);
        }
    } else {
        tdomf_ajax_exit($form_id, tdomf_get_message_instance(TDOMF_OPTION_MSG_SUB_ERROR, $form_id, false, false, $message), false, false, $post_id);
    }
} else {
    if ($_POST['tdomf_action'] == "preview") {
        tdomf_log_message("Someone is attempting to preview something");
        $message = tdomf_validate_form($tdomf_args, true);
        if ($message == NULL) {
            tdomf_log_message("Submission validated. Generating preview...");
            $message = tdomf_preview_form($tdomf_args);
            tdomf_log_message("Now sending back to form using AJAX!");
            tdomf_ajax_exit($form_id, $message, false, true, $post_id);
        } else {
            tdomf_ajax_exit($form_id, sprintf(__("Your submission contained errors:<br/><br/>%s<br/><br/>Please correct and resubmit.", "tdomf"), $message), false, false, $post_id);
        }
    } else {
        tdomf_ajax_exit($form_id, sprintf(__("TDOMF (AJAX) ERROR: unrecognised action %s!", "tdomf"), $_POST['action']), true, false, $post_id);
    }
}
tdomf_ajax_exit($form_id, __("ERROR! Should never reach here.", "tdomf"), true, false, $post_id);