Widget_Click not working with popup

Widget_Click not working with popup

  

I thought this was sorted but my widget_click that clicks a hidden button to call a popup screen does not open up the popup.  I have the popup widget and the widget click pointing to the button which points to the popup screen but it doesn't do anything and when I debug it just steps over it without opening up the screen and carries on as if it didn't exist.

I'm running v11 and the oml is attached to this message in case anyone can take a look.  The hidden button with the popup widget is AddChildAgeButton on the BookingDetail screen and the widget click is in the BookRoom screen action in the same screen.

Hi Sienna,

As the desription of Widget_Click already says, it doesn't work for links with Navigate or Submit (so only for those with Ajax Submit):


So this effectively means that you can't start a pop-up with it (unless there's a way to start a pop-up via an Ajax Submit, but I don't think there is).

I already tried that to no avail.  I had both the BookRoom and the AddChildAgeButton buttons set to Ajax Refresh but no joy.

....so it seems that it's just not possible as the calling button (AddChildAgeButton) needs to be set to Navigate as it's calling a screen, but yet it can't be for the widget click purposes.  Seems odd that it isn't possible unless there's a different way to do it altogether....?

Kilian Hekhuis wrote:

Hi Sienna,

As the desription of Widget_Click already says, it doesn't work for links with Navigate or Submit (so only for those with Ajax Submit):


So this effectively means that you can't start a pop-up with it (unless there's a way to start a pop-up via an Ajax Submit, but I don't think there is).

For anyone reading this, I marked this as the solution purely to show that there is no solution, i.e. it's not possible to call a popup using a widget click.


Well, it's possible to navigate to a Screen using a Screen Action that ends in a Redirect, but that'll open in the current tab, you can't make it open in a pop-up.

I was under the impression that widget_click was just a simple $(elem).trigger('click');

Perhaps it's an idea to try a bit of javascript to simulate a click on the widget?

I do recall having some issues before using a widget click on an element which has display set to false, it might be an optimization thing to prevent that from working? instead of setting display to false, keep it on true and instead setup an extra style attribute with the value "display:none;"

Not sure if that will work though...

Yes, I'm just changing it to a regular screen and calling it explicitly from a screen action, however my original intent of calling a popup without any user interaction just isn't possible it seems.  Thanks for your input though, appreciated!

Joey Moree wrote:

I was under the impression that widget_click was just a simple $(elem).trigger('click');

Perhaps it's an idea to try a bit of javascript to simulate a click on the widget?

Yes funnily enough I was just chatting with a colleague about the option of writing some java to do it instead.  Do you think that would work or will I still have the same problem does anyone know?


Solution

Sienna Davids wrote:

Joey Moree wrote:

I was under the impression that widget_click was just a simple $(elem).trigger('click');

Perhaps it's an idea to try a bit of javascript to simulate a click on the widget?

Yes funnily enough I was just chatting with a colleague about the option of writing some java to do it instead.  Do you think that would work or will I still have the same problem does anyone know?


I just tested, the widget_click action does work!
The problem lies with the link having Visible set to False.
It seems Outsystems does some optimization to not allow a widget_click on an element which has Visible set  to false!

To solve this set Visible to True and in Extended Properties add style with value "display:none;"

This should solve your problem :)

Solution

Just tried with the visible of the button set to true and it surprisingly it works!  Although it doesn't display the table properly now, not sure why yet.

Sienna Davids wrote:

Just tried with the visible of the button set to true and it surprisingly it works!  Although it doesn't display the table properly now, not sure why yet.


Perhaps you can check out the style on screen with your browsers inspector? (for chrome it's F12).

You can even add some css during runtime to try to get it working (this saves you alot of publishes, trust me! haha)

Ah, yeah, forgot about that pesky "visible" setting :( Thanks Joey for reminding me.

Therefore (for anyone reading this) the widget click stating that it doesn't work with the navigate method only relates to links and not buttons and was in fact a red herring!

....and thanks everyone - much appreciated!!