INightmare's Blog

Modifying LiftScreen buttons

Modifying LiftScreen buttons

If you’re using Lift Framework chances are you are using LiftScreen to build forms. While this is a handy tool, at the moment there is little documentation on how to customize it. LiftScreen is rendered by loading wizard-all.html template, however you probably have notices that the template doesn’t allow you to customize Cancel and Finish buttons directly. So if you want to add style, class or id attribute to the button, how do you do that?

The buttons are actually defined as methods in LiftScreen:

def finishButton = <button>(S ? "Finish")</button>
def cancelButton = <button>(S ? "Cancel")</button>

So in your screen you can simply override those methods:

class MyScreen extends LiftScreen {
  override def finishButton = <button class="btn">(S ? "Save")</button>
}