Forums

adding offset to error

arampro 30 Sep, 2019
Hi,
Is there a way to add an offset of xx px to the error messages?
I have a sticky header, so the validation scrolls to the first error (as it should be), but it is behind my header.
I tried to add the following code in the 'Setup'-tab, in the 'fail' section of 'Validation Fields', above the "Event loader".
jQuery( document ).ready(function($) {
$('html,body').animate({
scrollTop: $(".error").offset().top - 300
}, 1000);
});
But that did not work.
I'm using "v6 classic mode", "AJAX submit" is yes.
How can I make this code work?
Thx in advance,
Aram
GreyHead 30 Sep, 2019
Hi Aram,

Please try adding a z-index to the error message CSS - that should allow you to bring it forward in front of the header.

Bob
arampro 30 Sep, 2019
Hi Bob,
Thanks for the quick answer. Z-index will only mess up the design. This could be avoided if I was able to add a script when validations fails.
But anything put in the 'fail'-section get ignored (even though it is above "Event loader"). Even een simple message get ignored.
1. what do I need to make the blocks in the 'fail'-section work?

As an alternative,
2. Is it possible to disable this particular behavior, so i can add my own script in my js-file?

Again, thanks in advance,
Aram
GreyHead 30 Sep, 2019
Hi Aram,

Sorry, I don't know how to do that in CFv6 :-( Hopefully healyhatman or Max will be able to help you.

Bob
healyhatman 01 Oct, 2019
You can't just put script in the "fail" event, that's stuff that happens on the backend.
This topic is locked and no more replies can be posted.