diff --git a/webapp/static/script.js b/webapp/static/script.js index 9dcebaf..f3236d8 100644 --- a/webapp/static/script.js +++ b/webapp/static/script.js @@ -13,7 +13,12 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import { validateForm, eraMap, occupationSetMap } from "./validators.js"; +import { + validateForm, + eraMap, + countriesMap, + occupationSetMap, +} from "./validators.js"; // Cards and buttons // const characterCard = document.getElementById("character-card"); const generateBasicButton = document.getElementById("generate-basic-btn"); @@ -65,8 +70,9 @@ const advancedForm = { // Basic Form const basicForm = { HTMLElement: document.getElementById("form-basic"), - eraForm: document.getElementById("validation-era"), - occupationSetForm: document.getElementById("validation-occupation-set"), + countryForm: document.getElementById("validation-country-basic"), + sexForm: document.getElementById("validation-sex-basic"), + occupationForm: document.getElementById("validation-occupation-basic"), }; function delay(time) { @@ -213,7 +219,7 @@ function generateCharacter(form) { let firstName = form?.firstNameForm?.value ?? ""; let lastName = form?.lastNameForm?.value ?? ""; - let country = form?.countriesMap?.get(countryForm.value); + let country = countriesMap.get(form?.countryForm.value); let age = form?.ageForm?.value; let sex = form?.sexForm?.value.toLowerCase(); let year = form?.yearForm?.value; diff --git a/webapp/static/validators.js b/webapp/static/validators.js index 0ce71e6..67c8fd9 100644 --- a/webapp/static/validators.js +++ b/webapp/static/validators.js @@ -162,4 +162,4 @@ function validateTags(tags) { return true; } -export { validateForm, eraMap, occupationSetMap }; +export { validateForm, eraMap, countriesMap, occupationSetMap }; diff --git a/webapp/templates/generator.html b/webapp/templates/generator.html index d307eea..5f81a7f 100644 --- a/webapp/templates/generator.html +++ b/webapp/templates/generator.html @@ -79,49 +79,68 @@

- -
+ + +
- +
+ -
Please use valid era
+
+ Please use valid country. +
- -
+ +
- +
+ -
Please use valid era
+
Please use valid gender.
+ +
+ + +
Please select an occupation.
+
+