F.K.
F.K.

Reputation: 45

Java: Javascript function does not trigger on Wicket button's onclick event

I have a Javascript function that triggers on a button's "onclick" event.

<input type="button" value="Verify" id="b1" onclick=myFunction() />

I need to disable this button on another button's onSubmit() method in Wicket. For that I figure I'll use setEnabled(false). But if I bind the button with Wicket, its onclick event in HTML does not trigger.

HTML:

<input type="button" wicket:id="verify" value="Verify" id="b1" onclick=myFunction() />

Java:

public class MyPanel  extends Panel {
    public MyPanel(...){
        // other components

        Button verify = (Button) new Button("verify");
        verifyThumb.setEnabled(true);

        // other components
    }
}

I need to call the Javascript function as well as disable the button.

Upvotes: 0

Views: 497

Answers (2)

Ramkee
Ramkee

Reputation: 928

Please verify your input tag. You have missed "" for onclick event.

<input type="button" wicket:id="verify" value="Verify" id="b1" onclick="myFunction()" />

Upvotes: 1

Leon Marzahn
Leon Marzahn

Reputation: 349

Simple:

<input type="button" wicket:id="verify" value="Verify" id="b1" onclick="myFunction()" />

You have to put quotes around the onclick function

Upvotes: 1

Related Questions