Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Simulate "button.setEnabled" on javascript

Amine BENMANSOUR
5 years ago May 15, 2016 2:59pm
Johannes Häyry
5 years ago May 16, 2016 9:01am

If you have actually disabled the button in server side with setEnabled(false), I'm pretty sure you cannot change the Button state from javascript code anymore. You might be able to disable and enable it with JavaScript not actually changing the Button state in server but only in browser.

Then the mandatory question: What are you trying to achieve in the end?

Amine BENMANSOUR
5 years ago May 16, 2016 9:38am

in java code i was not able to get scroll position of my panel in order to enable/disable my submit button if the scroll position was in the end position. so i disable the button in initialization of the panel (java), i add a click listener on my panel to get scroll position with javascript code (because the methode getScrollPosition in java was return always 0), if the scroll position was in the end then i enable my button with javascript code.

panel.addClickListener(new ClickListener() {
@Override
public void click(ClickEvent event) {
Page.getCurrent().getJavaScript().execute("if the scroll is in the end then i enable the button with javascript code");

}
});