Announcement
Collapse
No announcement yet.
X
-
Originally posted by Isomorphic View PostHowever, now that you've told us what you're trying to do, the point is moot anyway, since even if submitValues fired on a blur, using that handler is the wrong approach: you should only be hiding your form after a successful save, otherwise, you could have validation errors and hide the form anyway.
Originally posted by Isomorphic View PostThe simplest approach for your use case is probably just to watch for the dataChanged event on the target DataSource. If you're worried about saves from other components wrongly triggering the hiding of your form, you can check the componentId property on the DSRequest.
Leave a comment:
-
Make sure you check whether the response was successful (dsResponse.status), or, as previously mentioned, you could end up hiding your form when the save failed.
Leave a comment:
-
saveOnEnter and saveOnBlur do indeed trigger the same behavior: they save. However, the concept of submitting is different and always has been - it's when the user actively submits the data. This concept comes from HTML, not us.
However, now that you've told us what you're trying to do, the point is moot anyway, since even if submitValues fired on a blur, using that handler is the wrong approach: you should only be hiding your form after a successful save, otherwise, you could have validation errors and hide the form anyway.
The simplest approach for your use case is probably just to watch for the dataChanged event on the target DataSource. If you're worried about saves from other components wrongly triggering the hiding of your form, you can check the componentId property on the DSRequest.
Leave a comment:
-
I know I can customize the saving in transformRequest() but that is at model level and I need to make adjustments at UI level. More exactly after the user enters a value in the TextItem and presses Enter or leaves the TextItem, a record gets added to the DataSource using the entered data (I am able to do this) AND the form containing the TextItem gets removed from the UI and replaced with a Button or other component (this is the tricky part).
I know I can add KeyPress and Blur handlers to the text field as a work around but I was hoping that there is a possibility to trigger the Submit action of the form (through saveOnEnter and saveOnBlur) and in the SubmitValuesHandler I can do my UI changes and then add my record to the DataSource... To me saveOnEnter and saveOnBlur sound like triggering the same behaviour...
Leave a comment:
-
See docs- saveData() is not marked as an override point. You can see of course that saving is attempted, so you can put code in lots of different places, such as DataSource.transformRequest(), to customize how saving is done.
Leave a comment:
-
I am just trying to do some custom actions and then add a Record to a data source (using the text from the TextItem) on enter or blur events on a text field. Enter action works just fine but not the blur one. I have updated the test case where even if I override the saveData() method of the form it is not entering there...Attached Files
Leave a comment:
-
SubmitValues handler is for Enter keypresses, and parallels the HTML submit button. The implicitSave mechanism just calls saveData(), and does not do a submit.
How is this affecting you? What is it you're trying to do?
Leave a comment:
-
SubmitValuesHandler not called for setImplicitSaveOnBlur(true)
For a simple DynamicForm with a TextItem and with:
Code:setSaveOnEnter(true); setImplicitSaveOnBlur(true);
Test case attached.
SmartGWT: v12.1p_2020-06-19/LGPL Development Only (built 2020-06-19)Attached FilesTags: None
Leave a comment: