dovahkiin
dovahkiin

Reputation: 718

Tapestry5 Button Appearance

In tapestry5 is possible to change a submit button text?

In jquery is possible as is indicated here. But using java methods, how is possible?

Upvotes: 0

Views: 835

Answers (3)

dovahkiin
dovahkiin

Reputation: 718

This is the way I did it using Tapestry5-jquery button mixin:

In tml:

<input t:type="submit" t:id="nextBtn" t:mixins="jquery/button" t:params="nextButtonParams" />

In java:

public JSONObject getNextButtonParams(){
    String label = "Next";
    if(userIndex == selectedUsers.size() - 1)
        label = "Finish";

    return new JSONObject("label", label);
}

Upvotes: 0

pstanton
pstanton

Reputation: 36640

henning's answer is spot on, however if you indeed want to use "java methods" you can use the prop binding prefix like so:

in your tml:

<input type="submit" t:type="submit" t:value="prop:submitText" />

in your java:

public String getSubmitText()
{
    return "Submit me!";
}

Using Binding Expressions

Upvotes: 1

Henning
Henning

Reputation: 16311

Sure you can! Just use the same value attribute in your TML that you would in plain HTML:

<input type="submit" t:type="Submit" value="Submit me!" />

Check the Submit component reference for further options.

Upvotes: 3

Related Questions