Jump to content

UniDateTimePicker cancels the update when the date is wrong


TSeba

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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();
}

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...