adding the health form api and validation

This commit is contained in:
Chris Cochrun 2024-01-08 14:12:29 -06:00
parent e28ce85c7f
commit 65f186fadc
5 changed files with 491 additions and 6 deletions

View file

@ -48,6 +48,7 @@
document.getElementById('warning').style.visibility = 'visible';
document.getElementById('warning').style.height = '';
document.getElementById('warning').style.margin = '';
return false;
}
};
@ -62,15 +63,17 @@
data.append("age", age);
/* data.delete("image"); */
validate(data);
if (!validate(data)) {
return
};
let obj = {};
data.forEach((value, key) => obj[key] = value);
// For use in dev
// Can now start using this in production IF,
// I get the server running on the server
let base = "https://api.tfcconnection.org/health-form";
/* let base = "http://localhost:4242/health-form"; */
/* let base = "https://api.tfcconnection.org/health-form"; */
let base = "http://localhost:4242/health-form";
fetch(base, {
method: "POST",
body: data
@ -326,13 +329,15 @@
<div class="basis-full flex flex-wrap items-center">
<input type="radio" id="agreement" name="agreement"
onclick="process()" value="yes"
class="flex-none form-input {{ $formClasses }} checked">
class="flex-none form-input {{ $formClasses }} checked"
required>
<label for="agreement" class="flex-auto">Yes</label>
</div>
<div class="basis-full flex flex-wrap items-center">
<input type="radio" id="agreement" name="agreement"
onclick="process()" value="no"
class="flex-none form-input {{ $formClasses }} ">
class="flex-none form-input {{ $formClasses }} "
checked>
<label for="agreement" class="flex-auto">No</label>
</div>
</div>