view raw
andrei.olar andrei.olar - 1 year ago 35
Java Question

Can't save value when switching from one tab to another java GWT

I have this login/registration app. The registration part is build out of 2 parts. (A TabPanel with 2 tabs). The first tab checks the email and if it's valid, unlocks the second tab. The second tab is where the actual registration form is.

I want to use the email from the first tab, as the email in the second tab, so the user can only register with that email, therefor it is not editable.
But the problem is the email is not visible in the second tab. Why is that happening ?

// variable declaration
private static String email;

// constructor
public RegisterViewImpl() {

Widget tabBar = createRegistrationForm();


private static Widget createRegistrationForm() {

TabPanel tabPanel = new TabPanel();

// Create the e-mail tab
Widget emailCheckerWidget = createEmailChecker();
tabPanel.add(emailCheckerWidget, RegistrationFormConstants.CHECK_EMAIL_TAB);

// Create the Personal Information Tab
Widget personalInformationWidget = createPersonalInformationWidget();
tabPanel.add(personalInformationWidget, RegistrationFormConstants.DETAILS_TAB);


private static Widget createEmailChecker() {


submitButton.addClickHandler(new ClickHandler() {

public void onClick(ClickEvent event) {
// this is how I save my email
email = emailBox.getText();

private static Widget createPersonalInformationWidget() {


// E-Mail Address
Label emailAddress = new Label("E-Mail Address");
final TextBox emailBox = new TextBox();
// this is how I want ot set it



You create your form before a user enters his or her email. Therefore, your form does not show it. emailBox.setText(email); should be called after a user clicked on the submit button.