cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
cmykkid
Nintex Newbie

Javascript Focus on Form Drop Down List

Jump to solution

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

0 Kudos
Reply
3 Replies
paul_crawford
Nintex Newbie

Re: Javascript Focus on Form Drop Down List

Jump to solution

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

View solution in original post

Reply
cmykkid
Nintex Newbie

Re: Javascript Focus on Form Drop Down List

Jump to solution

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.

0 Kudos
Reply
paul_crawford
Nintex Newbie

Re: Javascript Focus on Form Drop Down List

Jump to solution

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