Hello Community,
Please remind me how to call webblock's Save action from parent screen's Save action.
I have one web screen and it has 2 web blocks. So when I am clicking Save from the screen, save actions of both web blocks should be clicked.
Thanks and Regards,
Suraj Borade
Hi Suraj,
Complementing on what Ângelo has said:
$('.classButton1').click(); $('.classButton2').click();
That should be it.
Cheers,
José
You can't do that out of the box. You may have luck with the event systems component.
Hi sir,
I remember that I have implemented this behaviour or close to this in the past but not getting how I did that.
Hello Suraj
As Kilian said, what OutSystems has built-in is the complete opposite of what you are trying to achieve
To do what you want, I would suggest JavaScript to auto-click the two buttons inside the WebBlock
You have to name both buttons, and, in the action called by the 'parent' button you should use a RunJavaScript action with something like
document.getElementById('yourLinkID').click();
I'm not totally sure this will work because the two buttons aren't directly on the screen but in two embedded webblocks, but it's worth the shot
Let me know if this worked out or if you have any issues doing this
Regards,
Ângelo
Just a reminder that in the above solutions you might have some problems handling exceptions. If the second click on the save button raise an exception you won't recover from the first save without additional logic.
I don't see any other / perfect solution also...
Hey thanks everybody.
Angelo and Jose your solution worked. In the past I had done this with Javascript as suggested by Angelo but now I improved it to use jQuery.
Andre: Exception handling is out of reach now and we don't care but thanks for the suggestion and I will consider that in the future.
I am attaching the oml here if someone needs that in the future.
For future reference, please note that in above oml, I haven't hidden buttons from the web blocks. You need to hide it.
Hi, the solution posted here does not seem to work in OS11 for traditional web. Any idea of how can I make it work?
Thank you!
Hi Ulises,
Can you be a bit more specific? What doesn't work? Have you tried to debug your implementation to understand where the problem is?
Without giving it much thought I'd expect this solution to still work in OutSystems 11 for a Traditional Web application.
Hi,
The button in the parent does not click the button in the webblock. In the example provided above by Suraj, the Save button in the parent does all the logic in its flow, but never clicks on the save in the WB (I inserted a feedback message in the logic of the WB save button).
My guess is that the class is never set in the WB button.... how can we check if the class is being set? or what other problem could it be happening?
Thanks
Hi Ulises
To see if the button inside the web block has the class assigned to it you can use the inspect tool, find the button in the html and see if it's using the class you want