#set default values
#submit msg
$profile->msg_updateSuccess = "Your Profile was updated successfully.";
//set all output to be returned instead of printed
$profile->returnOutput = true;
//test for last page and no errors to submit form, otherwise start form
if (@$_POST['formitable_multipage'] != "end" || isset($profile->errMsg)) {
    $profileOpen = $profile->openForm();
    $smarty->assign('profileOpen', $profileOpen);
} else {
    $profile->submitForm(false);
}
//first page - test for no submit OR errors set with a field on the first page
if (!isset($_POST['submit']) || isset($profile->errMsg) && isset($_POST['firstname'])) {
    #print first page
    $page1 = "page 1";
    $smarty->assign('page1', $page1);
    $fname = $profile->printField('firstname');
    $smarty->assign('fname', $fname);
    $lname = $profile->printField('lastname');
    $smarty->assign('lname', $lname);
    $end = $profile->multiPage("end");
    $smarty->assign('end', $end);
    $profileClose = $profile->closeForm();
    $smarty->assign('profileClose2', $profileClose);
} else {
    $smarty->assign('updateMsg', $profile->submitMsg);
    #unset prevPath
    unset($_SESSION['prevPath']);
}
$content = $smarty->fetch("./user/user.upd_profile.tpl.html");
$staff->setDefaultValue('account_status', 'Active');
//set all output to be returned instead of printed
$staff->returnOutput = true;
//test for last page and no errors to submit form, otherwise start form
if (@$_POST['formitable_multipage'] != "end" || isset($staff->errMsg)) {
    $staffOpen = $staff->openForm();
    $smarty->assign('staffOpen', $staffOpen);
} else {
    $staff->submitForm(false);
}
//first page - test for no submit OR errors set with a field on the first page
if (!isset($_POST['submit']) || isset($staff->errMsg) && isset($_POST['firstname'])) {
    #print first page
    $page1 = "page 1";
    $smarty->assign('page1', $page1);
    $id = $staff->printField('identifier');
    $smarty->assign('id', $id);
    $fname = $staff->printField('firstname');
    $smarty->assign('fname', $fname);
    $lname = $staff->printField('lastname');
    $smarty->assign('lname', $lname);
    $reg_date = $staff->printField('reg_date');
    $smarty->assign('reg_date', $reg_date);
    $username = $staff->printField('username');
    $smarty->assign('username', $username);
    $password = $staff->printField('password');
    $smarty->assign('password', $password);
    $pass_verify = $staff->printField('password', '', true);
    $smarty->assign('pass_verify', $pass_verify);
    $chg_pass = $staff->printField('change_password');
    $smarty->assign('chg_pass', $chg_pass);
$staff->msg_updateSuccess = "{$nm[0]['firstname']} {$nm[0]['lastname']}'s account data was changed.";
//set all output to be returned instead of printed
$staff->returnOutput = true;
//test for last page and no errors to submit form, otherwise start form
if (@$_POST['formitable_multipage'] != "end" || isset($staff->errMsg)) {
    $staffOpen = $staff->openForm();
    $smarty->assign('staffOpen', $staffOpen);
} else {
    $staff->submitForm(false);
}
//first page - test for no submit OR errors set with a field on the first page
if (!isset($_POST['submit']) || isset($staff->errMsg) && isset($_POST['firstname'])) {
    #print first page
    $page1 = "page 1";
    $smarty->assign('page1', $page1);
    $fname = $staff->printField('firstname');
    $smarty->assign('firstname', $fname);
    $lname = $staff->printField('lastname');
    $smarty->assign('lastname', $lname);
    $acc = $staff->printField('account_status');
    $smarty->assign('acc', $acc);
    $chg = $staff->printField('change_password');
    $smarty->assign('chg', $chg);
    $end = $staff->multiPage("end");
    $smarty->assign('end', $end);
    $staffClose = $staff->closeForm();
    $smarty->assign('staffClose2', $staffClose);
} else {
    $smarty->assign('updateMsg', $staff->submitMsg);
    #unset prevPath
    unset($_SESSION['prevPath']);
if (!isset($_POST['submit']) || isset($_POST['submit']) && $newForm->submitForm() == -1) {
    $newForm->openForm();
}
if (!isset($_POST['submit'])) {
    $newForm->openForm();
}
//hide primary key field, force a few field types
$newForm->hideField("ID");
$newForm->forceTypes(array("foods", "day_of_week"), array("checkbox", "radio"));
//get data pairs from another table
$newForm->normalizedField("toon", "formitable_toons", "ID", "name", "pkey ASC");
#print_r($newForm->_getFieldData('toon')
//set custom field labels
$newForm->labelFields(array("f_name", "l_name", "description", "pets", "foods", "color", "day_of_week", "b_day", "toon"), array("First Name", "Last Name", "About Yourself", "Your Pets", "Favorite Foods", "Favorite Color", "Favorite Day", "Your Birthday", "Favorite Cartoon"));
$newForm->registerValidation("required", ".+", "Input is required.");
$newForm->validateField("f_name", "required");
$newForm->uniqueField("f_name", "fname is already registered.");
print_r($newForm->validate);
echo isset($newForm->validate[f_name]);
$newForm->printField("f_name");
$newForm->printField("l_name");
//output form
#$newForm->printForm();
#$newForm->printField('toon');
$newForm->closeForm();
#$newForm = @mysql_list_fields($DB, "formitable_demo", @mysql_connect("localhost",$user,$pass));
#print($newForm);
?>

</td></tr></table>
</body></html>
//test for last page and no errors to submit form, otherwise start form
if (@$_POST['formitable_multipage'] != "end" || isset($newForm->errMsg)) {
    $newForm->openForm();
} else {
    $newForm->submitForm();
}
#print_r($newForm->errMsg);
//first page - test for no submit OR errors set with a field on the first page
if (!isset($_POST['submit']) || isset($newForm->errMsg) && isset($_POST['FName'])) {
    /*** open form pg 1 of 3 ***/
    ?>
<h3>Page 1 of 3</h3>
<table align="center">
<tr> <!-- valign bottom to stay aligned when there is an error message. -->
<td width=225 valign="bottom"><?php 
    $newForm->printField("FName");
    ?>
</td>
<td width=225 valign="bottom"><?php 
    $newForm->printField("MName");
    ?>
</td>
<td width=225 valign="bottom"><?php 
    $newForm->printField("LName");
    ?>
</td>
</tr>
<tr>
<td width=225 valign="bottom"><?php 
    $newForm->printField("Email");
    ?>
$staff->validateField("email", "required");
//set all output to be returned instead of printed
$staff->returnOutput = true;
//test for last page and no errors to submit form, otherwise start form
if (@$_POST['formitable_multipage'] != "end" || isset($staff->errMsg)) {
    $staffOpen = $staff->openForm();
    $smarty->assign('staffOpen', $staffOpen);
} else {
    $staff->submitForm(false);
}
//first page - test for no submit OR errors set with a field on the first page
if (!isset($_POST['submit']) || isset($staff->errMsg) && isset($_POST['firstname'])) {
    #print first page
    $page1 = "page 1";
    $smarty->assign('page1', $page1);
    $id = $staff->printField('id');
    $smarty->assign('id', $id);
    $fname = $staff->printField('fname');
    $smarty->assign('fname', $fname);
    $lname = $staff->printField('lname');
    $smarty->assign('lname', $lname);
    $email = $staff->printField('email');
    $smarty->assign('email', $email);
    $end = $staff->multiPage("end");
    $smarty->assign('end', $end);
    $staffClose = $staff->closeForm();
    $smarty->assign('staffClose3', $staffClose);
} else {
    #submit msg
    $smarty->assign('updateMsg', $staff->submitMsg);
    #unset prevPath
//set up fields for validation using regexs above
$sec->validateField("profile_id", "required");
#set default values
$sec->setDefaultValue('object', $objectpath);
$nmSQL = "SELECT profile FROM sionapros_profiles WHERE profile_id = {$_POST['profile_id']}";
$nm = $db->execute($nmSQL);
$sec->msg_insertSuccess = "The object {$objectpath} is now only accessible to users under the {$nm[0]['profile']} profile.";
//set all output to be returned instead of printed
$sec->returnOutput = true;
$smarty->assign('msg', $msg);
$smarty->assign('assignedTo', $assignedTo);
$smarty->assign('result', $result);
$smarty->assign('objectpath', $objectpath);
if (!isset($_POST['submit']) || isset($_POST['submit']) && $sec->submitForm(false) == -1) {
    $secOpen = $sec->openForm();
    $smarty->assign('secOpen', $secOpen);
    $objectId = $sec->printField('object');
    $smarty->assign('objectId', $objectId);
    $profile = $sec->printField('profile_id');
    $smarty->assign('profile', $profile);
    $secClose = $sec->closeForm();
    $smarty->assign('secClose', $secClose);
    //        $secForm = $sec->printForm();
    //        $smarty->assign('sec', $secForm);
} else {
    #submit msg
    $smarty->assign('updateMsg', $sec->submitMsg);
    #unset prevPath
    unset($_SESSION['prevPath']);
}
$content = $smarty->fetch("./security/tm0.security.add_object.tpl.html");