scrolling to the first error after submit


Badge +4

I want to scroll to the first error after submit.

The position is: NWF$(".nf-validator-error:visible").first().offset().top

The problem is that I can't add listener to the submit button. 

I can't do like this:

NWF$("input[type=submit][value=send]").click(function(){})

So...

1. Is there OOTB solution?

2. if not - how may I add event listener to an submit button (responive file)


3 replies

Userlevel 5
Badge +14

responsive forms do not support any custom javascript code.

and unfortunately there is any OOTB functionality that would automatically navigate to the first invalidated control

Badge +4

It supports code by adding a richtext with "<script src=''>" can.

I have used a code that make this in that way

NWF$(document).ready(function () {
NWF.FormFiller.Events.RegisterAfterReady(function (){
NWF$("input[type=submit][value=שליחה], input[type=submit][value=שמירה]").click(function(){
var stepIn = NWF$(".nf-validator-error:visible").first().parents("div[data-controlname=לוח]").attr("id");
document.getElementById(stepIn).scrollIntoView();
})
})

})

using a function that add "id" to every panel

Userlevel 5
Badge +14

it's just a hack.

even it works, it doesn't mean it's supported. it works in current release(s), but need not in future ones.

see official warning from NINTEX representative

https://community.nintex.com/message/78428-re-unable-to-find-the-custom-javascript-text-area-in-nintex-responsive-forms?… 

Reply