TSeba Posted October 29, 2019 Share Posted October 29, 2019 Hi! I have a UniDbGrid in a project and one of the columns has a TDateTime field and it has an associated UniDateTimePicker in the Editor property. When the program is executed and I insert a new record, in the date field if I report an incorrect date value, the behavior is that I cancel the record that I am loading instead of generating a message informing that the date entered is incorrect. How can I avoid canceling the registration and generating the message with the error and the possibility for the user to correct it?. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2019 Share Posted October 29, 2019 1 hour ago, TSeba said: I have a UniDbGrid in a project and one of the columns has a TDateTime field and it has an associated UniDateTimePicker in the Editor property. When the program is executed and I insert a new record, in the date field if I report an incorrect date value, the behavior is that I cancel the record that I am loading instead of generating a message informing that the date entered is incorrect. How can I avoid canceling the registration and generating the message with the error and the possibility for the user to correct it?. Hi, Can you please make a simple testcase? Also, this link may help you: http://docwiki.embarcadero.com/Libraries/Berlin/en/Data.DB.TField.OnValidate Quote Link to comment Share on other sites More sharing options...
TSeba Posted October 30, 2019 Author Share Posted October 30, 2019 Hi Within the Demo projects there is one called GridEditors (gedit.dproj). If in that project I want to insert a new record and in the column "Hire Date" I enter manually for example "45/45/4545" and then press the Tab key automatically cancels the record that I am registering. While I am loading the wrong date, it generates the hint with the error message, but it would be good if I generated that message when I left and did not cancel the registration. The same happens with the modification, if I manually change a date in the "Hire Date" field to an incorrect value, the edition is canceled. Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 31, 2019 Share Posted October 31, 2019 18 hours ago, TSeba said: Within the Demo projects there is one called GridEditors (gedit.dproj). If in that project I want to insert a new record and in the column "Hire Date" I enter manually for example "45/45/4545" and then press the Tab key automatically cancels the record that I am registering. While I am loading the wrong date, it generates the hint with the error message, but it would be good if I generated that message when I left and did not cancel the registration. The same happens with the modification, if I manually change a date in the "Hire Date" field to an incorrect value, the edition is canceled. Hi, If I understand you correctly, try this approach too. UniDBGrid.ClientEvents.ExtEvents -> function validateedit: function validateedit(editor, context, eOpts) { return this.columnManager.columns[context.field].getEditor().isValid(); } Quote Link to comment Share on other sites More sharing options...
TSeba Posted October 31, 2019 Author Share Posted October 31, 2019 It works perfect!!!. Thanks a lot!!! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.