Don't require both father and mother name

master
Skylar Ittner 1 year ago
parent 49f078c8fc
commit 83cfed0d0d

@ -60,17 +60,14 @@ switch ($VARS['action']) {
try {
$lastname = $VARS['familyname'];
$father = $VARS['fathername'];
$mother = $VARS['mothername'];
$father = $VARS['fathername'] ?? "";
$mother = $VARS['mothername'] ?? "";
if (empty($lastname)) {
errorBack("Enter a last name.");
}
if (empty($father)) {
errorBack("Enter a father name.");
}
if (empty($mother)) {
errorBack("Enter a mother name.");
if (empty($father) && empty($mother)) {
errorBack("Enter the father and/or mother's name.");
}
$family->setName($lastname);

Binary file not shown.

@ -139,11 +139,11 @@ class Family {
}
public function getFather(): string {
return $this->father;
return $this->father ?? "";
}
public function getMother(): string {
return $this->mother;
return $this->mother ?? "";
}
public function getPhone(): string {

@ -67,7 +67,8 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
"name" => "fathername",
"maxlength" => 255,
"value" => $family->getFather(),
"error" => "Enter the father's name."
"error" => "Enter the father's name.",
"optional" => true
],
[
"label" => "Mother's Name",
@ -75,7 +76,8 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
"name" => "mothername",
"maxlength" => 255,
"value" => $family->getMother(),
"error" => "Enter the mother's name."
"error" => "Enter the mother's name.",
"optional" => true
],
[
"label" => "Street Address",
@ -241,7 +243,9 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
value="<?php echo htmlspecialchars($item['value']); ?>"
<?php
}
?>required />
if (empty($item['optional'])) {
echo "required";
} ?>/>
<?php } else if ($item['type'] == "select") { ?>
<select class="form-control"
name="<?php echo $item['name']; ?>"

Loading…
Cancel
Save