Hi

I have a page which allows a user to update his profile. This includes a select 
component to choose the user's state of residence:

public Enum State {
    ALABAMA, ALASKA, ARIZONA ...
}

MyAccount.tml

// text fields etc.

<select t:type="select" t:id="state"
    t:blankLabel="please select" t:blankOption="always" 
    t:value="user.state" name="select" id="select"
    class="textbox_edit">
</select>

User.java

public class User {
    private State state;
    
    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }
}

public class MyAccount {
    private User user;

    void onActivate() {
        this.user = loadUser();
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}

As you can see I load the user's profile in the onActivate() method. Doing this 
pre-populates the form with the user's details but I need to set the state to 
the user's current state. Currently all the fields are pre-populated except the 
select fields. How do I tell T5 to set a select field to the current value?

Thanks

Toby

Reply via email to