Hi everyone,
this is my first question here in the forum, hope that someone can help me solve my task.
My idea/task would be to use a “Refresh Button Widget” in order to trigger the “Next” or the “Back” button at the bottom of the page on the server.
My goal is to give the user an easy way of going back and forward in my workflow, through different components: I have other buttons on a specific page and I have been requested to specifically guide the user via buttons, instead of using the “Next” or “Back” button to navigate the workflow.
So yes, you will still want to use the generic javascript view node, and I was able to get it working with this as the code inputted in my Javascript window (see below). Then I was able to skip to next page, the same process should be available going backwards as well. I do not think this will work with the refresh button widget, but you can style your button to look similar to the refresh button widget and accomplish this functionality.
var body = document.getElementsByTagName('body')[0];
var html = '<button id="coolButton">Button Text</button>';
body.innerHTML = html;
//either way below is acceptable syntax
//document.getElementById("coolButton").addEventListener("click", next);
document.getElementById("coolButton").onclick = next;
function next() {
//add functionality here
parent.document.querySelector('.right-button-subcontainer .button.primary').dispatchEvent(new Event('click'));
}
thank you very, very much for your fast reply.
That’s amazing, exactly what I was looking for!!
I was able to also trigger the back button thanks to you!
Just another quick question: if I would like then to disable the original “Next”/“Back” button (exactly because now I have a custom one(s)), is it possible/suggested to do that?
Following the thread at Automatically Change Webportal Pages After an Event, I understood that it would not be that difficult, but once I try to integrate the code, it does not really do anything (I’m missing something, for sure).
If someone is interested in the final result, here the KNIME workflow that contains the triggering of the Back and the Next buttons with some styling to make them similar to a KNIME button:
I have found a way to apply this to the refresh button widget. See the topic I started and later answered myself. I used the code from @rsrudd’s answer as a basis.