import {Form,FormError} from "form.js"; let initialValue = { email: 'a@b.com', password: '' }; function validate(values) { const errors = {}; if (!values.email) { errors.email = 'Required'; } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(values.email)) { errors.email = 'Invalid email address'; } if(values.password.length < 8) errors.password = 'Too short'; if(values.sex === undefined) errors.sex = 'Must be set'; return errors; } document.body.append(
Male Female Submit ); document.$("#theform").on("submit", function(evt){ Window.this.modal(Success: {JSON.stringify(evt.data)}); });