I'm using a button element to submit values. I want to check, if the input fields are filled
The 'required'-attribute does not work in this specific case, because I'm using pickadate.js, which disables that.
I made a javascript-function that is called on a button click. To stop the button from submitting, I've set the return to false:
<button type="submit" class="btn btn-primary"
onclick="checkIfFilled(); return false;"
data-loading-text="loading…">ButtonText</button>
Now I want to set the return false; to return true; using the javascript function checkIfFilled()
So if the check was successful, the data should be send like if there was no return false;
Edit for those who may have the question in the future: The solution is to return the function, which returns either true or false whenever you want it.
Thanks to Michael, musically_ut and Amani!
Thanks for reading!
onclick="return checkIfFilled()"?return false;from the HTML and returntrue/falsefromcheckIfFilleditself.