Skip to main content

This article is very helpful regarding how to control field form focus, but I can't figure out how to set the focus on a drop down list or button (Save or Cancel).

Specifically, here's the syntax for a date picker, but what's the syntax for a drop down list or save/cancel button?

NWF$('. datetimeFocus input.nf-date-picker').focus();

I'm pursuing controlling focus because the form rules don't fire after setting a field value with JavaScript. The only way I can get the rule to fire is if I change focus on some other field...either manually by clicking (don't want that) on the form or changing focus via JavaScript (want that).

Any help or other suggestions are appreciated.

Thanks,

Gary

Hi Gary Brown

To get the rule to apply after a javascript update just add the following:

NWF$('#' + yourfield).trigger("blur");

eg

function update(){

 NWF$('#' + yourfield).val("Hello");
 NWF$('#' + yourfield).trigger("blur");

}

Now whatever rule you have on that control will be fired.

Nintex forms is triggering rule events using onblur

Hope this helps


Thanks for the info Paul. Your code did the trick.

Still curious how to focus on a drop down list or Save/Cancel button though. Not necessary, just curious.

Thanks again.


Hi Gary Brown

To give a dropdown focus, give the dropdown a css class (in my case focus) and use the following code:

NWF$('.focus').find('select').focus();

To give a button focus, give the button a css class (in my case button) and use the following code

NWF$('.button').focus();

If the above helped you, can you mark as correct to help others find the answer?


Reply