scrolling on error

ernst@volny.cz 06 Nov, 2019
I have a longer form portrait.
If there is an error in the conditions, it will appear at the beginning of the form. https://jmp.sh/frXD1JY
However, the form remains with the submit button and the error is not visible - https://jmp.sh/Y3CMmSA.
This confuses the user.
Is it possible to scroll the form for this error or display it somewhere near the button submitted?
healyhatman 06 Nov, 2019
jQuery(document).ready(function() {
jQuery('.ui.form').form({
onFailure: function(formErrors, fields) {
// Do whatever you want here - scroll to top, display an alert, whatevs
}
});
});
ernst@volny.cz 06 Nov, 2019
Thank you. Please advise me yet how do I scroll up on this error message?
ernst@volny.cz 06 Nov, 2019
Where should I put this javascript? Can I put it on the form?
Can ajax be turned on?
it doesn't work for me
healyhatman 06 Nov, 2019
Put it in a Javascript block.
ernst@volny.cz 06 Nov, 2019
I tried that, but it doesn't work for me.
Can you write the code exactly?
healyhatman 06 Nov, 2019
Sorry my bad.
jQuery(document).ready(function() {
jQuery('.ui.form').on('submit', function() {
if(!jQuery(this).form('is valid')) {
alert('Oh noes.');
}
});
});
ernst@volny.cz 06 Nov, 2019
I'm sorry, but I still don't want to work.
See the settings. https://jmp.sh/FwC5MSJ
This topic is locked and no more replies can be posted.