I found few ways to set default submit button on page with GWT.
1. Add key press handler for all form fields check for enter button and take action. You can add common key press handler for all form fields. This way you are not adding multiple handler for each form field. (I am assuming you understand what is ui handler and how it works.)
2. Enclose all your form fields inside com.google.gwt.user.client.ui.FocusPanel and handle key press event on this focus panel.
3. Add page wide native event handler and intercept each event, check if it is enter button and take your action.
1. Add key press handler for all form fields check for enter button and take action. You can add common key press handler for all form fields. This way you are not adding multiple handler for each form field. (I am assuming you understand what is ui handler and how it works.)
@UiHandler({ "txtCompanyName", "txtcontactName", "txtEmail" }) public void onKeyPress(KeyPressEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { // TODO: Take your action. } }
2. Enclose all your form fields inside com.google.gwt.user.client.ui.FocusPanel and handle key press event on this focus panel.
@UiField FocusPanel mainPanel; . . . @UiHandler("mainPanel") public void allkyePressHandler(KeyPressEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { // TODO: Take your action. } }
3. Add page wide native event handler and intercept each event, check if it is enter button and take your action.
Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { // TODO: Take your action. } } });
شركة مكافحة الصراصير جنوب الرياض
ReplyDeleteشركة مكافحة البق بالرياض
شركة مكافحة بق الفراش شرق الرياض
شركة مكافحة بق الفراش شمال الرياض
شركة مكافحة بق الفراش غرب الرياض
شركة مكافحة بق الفراش جنوب الرياض
شركة جلي بلاط بالرياض
شركة جلي بلاط شرق الرياض
شركة جلي بلاط شمال الرياض
شركة جلي بلاط غرب الرياض
شركة جلي بلاط جنوب الرياض
رقم جلي بلاط بالرياض
جلي بلاط باكستاني
شركة تنظيف مسابح بالرياض