You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
682 B
25 lines
682 B
import * as riot from 'riot'
|
|
|
|
import FormValidator from './FormValidator'
|
|
import FieldError from './fieldError.riot'
|
|
|
|
// register & mount riot component
|
|
riot.register('field-error', FieldError)
|
|
riot.mount('field-error')
|
|
|
|
// creating formValidation
|
|
const formValidation = new FormValidator('form', {
|
|
'email': {
|
|
'presence': true,
|
|
'email': true
|
|
},
|
|
'password': {
|
|
'presence': true
|
|
}
|
|
}, (event, data) => {
|
|
event.preventDefault()
|
|
|
|
// show message and content of data from form
|
|
document.querySelector('#result .content').innerHTML = '<p>' + JSON.stringify(data) + '</p>'
|
|
document.querySelector('#result').classList.remove('hidden')
|
|
}) |