Answer the question
In order to leave comments, you need to log in
How to prevent sending an empty field to the server?
There is a comment attribute on the route object, for example. How to prohibit sending an empty, not filled, field to the Back? (despite the fact that the filled textarea needs to be sent, of course)
Angular || React || Native?
And that it at each sending there develops and clutters up a DB.
Answer the question
In order to leave comments, you need to log in
document.querySelector('#form').onsubmit = function(){
if (!document.querySelector('#textarea').value) {
return false;
}
}
document.querySelector('#form').onsubmit = function(event){
if (!document.querySelector('#textarea').value) {
event.preventDefault()
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question