0

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?

Community
  • 1
  • 1
dovahkiin
  • 708
  • 14
  • 34

3 Answers3

3

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.

Henning
  • 16,063
  • 3
  • 51
  • 65
1

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

pstanton
  • 35,033
  • 24
  • 126
  • 168
0

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);
}
dovahkiin
  • 708
  • 14
  • 34