1319
Views
6
Comments
Trigger Screen Action on Javascript 
Question

To have a javascript function calling a screen action 

1. Put a button on the webblack and hide it using css  (style="display: none;") 

2. Javascript function force the click action on that button when certain action is performed: $target.parents('.something').find('.otherthing').click();


But the click() seems not working.

2019-06-15 21-39-22
Afonso Carvalho
 
MVP

Hi,

Have you made certain that the find() is obtaining your button? Have you tried writing the same, but with an Id selector instead of class?

$('#" + TheButtonYouWantToClick.Id + "').click();
2020-09-17 01-03-04
Koushik Prathi

Hi QIUYAN LI,

Try Using widget click action available under rich widgets 

for more info go through this link https://www.outsystems.com/forums/discussion/27124/how-to-force-a-button-click-using-javascript/#Post99899

Regards,

Koushik

2021-03-30 06-52-52
Ali Amin

Hi QIUYAN LI,


Make sure you are getting element to generate event.  you can select element by id, class etc.


Thanks

2019-05-22 11-30-09
Marcelo Ferreira

Hi,

The best way of calling a screen action on JS is with Fake Notify. To accomplish that follow this steps:

  • Add a FakeNotifyWidget (from RichWidgets) to the block and create an OnNotify action for it
  • Name it (the FakeNotifyWidget) and on the onblur event of the desired input add the following:
    OsNotifyWidget('<FakeNotifyWidget>.Id', '<message>')
  • On the OnNotify action you can get the <message> using the NotifyWidgetGetMessage() built-in function and treat it accordingly

Regards,

Marcelo

2018-10-17 18-00-19
Carlos Gonçalves

QIUYAN LI wrote:

To have a javascript function calling a screen action 

1. Put a button on the webblack and hide it using css  (style="display: none;") 

2. Javascript function force the click action on that button when certain action is performed: $target.parents('.something').find('.otherthing').click();


But the click() seems not working.

do you have any error in console? Have you tryed this with a link instead of a button?

BR


2018-10-03 14-20-17
QIUYAN LI

Carlos Gonçalves wrote:

QIUYAN LI wrote:

To have a javascript function calling a screen action 

1. Put a button on the webblack and hide it using css  (style="display: none;") 

2. Javascript function force the click action on that button when certain action is performed: $target.parents('.something').find('.otherthing').click();


But the click() seems not working.

do you have any error in console? Have you tryed this with a link instead of a button?

BR


Hi, 

thank you for the reply.

No console error. 

And I have doubled check that I am able to click on the button, but not stop at the debugging point inside the screen action.

 It is a link <a>.

Do I need to return any Notify?


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.