Fixed registration form

This commit is contained in:
2018-02-05 14:25:02 +07:00
parent 05155af329
commit 38ea99d1b3
4 changed files with 594 additions and 575 deletions

View File

@@ -34,9 +34,13 @@ const registerForm = {
},
category: function(v) {
if (_.isEmpty(v)) return "Pilih kategori Anda"
},
email: function(v) {
if (_.isEmpty(v)) return "Masukkan email Anda"
}
}),
oninit: function(vnode) {
registerForm.form.email(vnode.attrs.u)
registerForm.form.name("")
registerForm.form.gender("")
registerForm.form.birthdate(moment().format("YYYY-MM-DD HH:mm:ss"))
@@ -76,7 +80,12 @@ const registerForm = {
}, m("form", {
onsubmit: function(e) {
e.preventDefault()
m.route.set("/questionnaires")
// m.route.set("/questionnaires")
if (!registerForm.form.isValid()) console.log('err', registerForm.form.error())
else {
registerForm.form.category(registerForm.form.category().id)
Respondent.save(registerForm.form.data())
}
},
style: {
padding: "1em",
@@ -124,7 +133,7 @@ const registerForm = {
value: registerForm.form.name(),
events: {
oninput: function() {
registerForm.form.name()
registerForm.form.name(this.value)
}
},
validate: function() {