I’m having the same problem as mihai007.
I have following code in an anonymous subclass of DynamicForm with setSaveOnEnter(true) and setCanSubmit(false).
If I use a Button with a ClickEvent-Callback to save(), my @Override method is accessed (all the methods have breakpoints). On ENTER, no breakpoint is hit. How can I interfere in the save-process of ENTER in order to add a DSCallback handler?
@Override
public void saveData() {
super.saveData();
}
@Override
public void saveData(DSCallback callback) {
super.saveData(callback);
}
@Override
public void submit() {
super.submit();
}
This is the way I have always done it & it works in 3.0:
// configure the form for enter-key autosubmission
form.setSaveOnEnter (true);
form.addSubmitValuesHandler (new SubmitValuesHandler () {
public void onSubmitValues (final SubmitValuesEvent submitValuesEvent) {
executeDefaultAction ();
}
});
I don’t remember why I started doing it this way.
Maybe the docs used to say to do it this way, or maybe I saw it somewhere.
Maybe this is enough to get you going for now…
Destroy the Form in the pop up window after setSaveOnEnter(true);
I have a add button in my ToolsStrip. When clicked on add button there pop s up a dynamic form window, after fetching the data and enter is clicked the data in my form gets saved (data is seen in the background grid). But the Dynamic Form in the pop up window does not gets destroyed.
Is there any handler/any way to destroy the window once data is being saved by clicking enter ?
Thanks for your reply, I tried your code. I dont know why but addSubmitValuesHandler is not triggered at all. The form does not gets destroyed.
But there should be a submit event triggered when we setsaveonenter is true. And if its overridden then we can destroy the pop up window after the data is saved. Some where I am missing it ..
Maybe somebody is calling a method like Canvas.addKeyPressHandler () to intercept the Enter key.
Then after receiving the event, they are calling KeyPressEvent.cancel () which might prevent the Enter key from reaching the form… Just a guess.
But FYI, the sample I posted earlier has always worked for me, and now I am using SmartGWT 4.0 from 2013-11-30, and it’s working with that build as well.