Browse Source

Ajuste em formulário de evento

master
Henrique Caetano de Barros 3 years ago
parent
commit
181391767d
1 changed files with 16 additions and 3 deletions
  1. +16
    -3
      script/eventos.js

+ 16
- 3
script/eventos.js View File

@ -31,10 +31,10 @@ const sendData = (form) => {
request.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText)
finish(this.responseText)
}
else if(this.readyState >= 4) {
alert('ERRO: ' + this.responseText)
finish('ERRO: ' + this.responseText)
}
}
@ -58,6 +58,7 @@ const sendData = (form) => {
}
const validator = (formData) => {
if(formData.get("titulo").length < 5) {
@ -80,19 +81,31 @@ const validator = (formData) => {
}
const finish = (text) => {
openCloseModal('none')
alert(text)
window.location.reload()
}
const openCloseModal = (acao) => {
document.getElementsByClassName('modal-content')[0].style.display = acao
document.getElementsByClassName('form')[0].style.display = acao
}
const numberMask = (element) => {
element.value = element.value.replace(/\D/g,'')
}
const currencyMask = (element) => {
var v = element.value.replace(/\D/g,'')
v = (v/100).toFixed(2) + ''
v = v.replace(".", ",").replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.')
element.value = v
}
}

Loading…
Cancel
Save