Jump to content

Validation Bug when using two TUniDBEdits in Grid


MarkB

Recommended Posts

I have a DBGrid with 4 fields, the first 2 are required and the Grid has RowEditor enabled.

Those two Columns have a TUniDBEdit control associated with them.

If I click the Plus button on the navigator, enter only data in the first field and click Confirm, I get a warning that the second field is required but the RowEditor stops responding to mouse clicks after that.

image.png.e832e301e10f48dcf0bf949f1b260a99.png

 

UniguiValidationBug.zip

Link to comment
Share on other sites

On 3/5/2020 at 4:57 AM, MarkB said:

If I click the Plus button on the navigator, enter only data in the first field and click Confirm, I get a warning that the second field is required but the RowEditor stops responding to mouse clicks after that.

I opened a ticket in the support portal.

One of the possible solutions for your case:

UniDBGrid1.ClientEvents.ExtEvents -> 

function validateedit(editor, context, eOpts)
{
    return (context.newValues[0] != "" && context.newValues[1] != "")
}

 

Link to comment
Share on other sites

  • 3 years later...

Something like this:

1.

function validateedit(editor, context, eOpts)
{
    if (context.newValues[0] == "" || !context.newValues[0]) {
        ajaxRequest(this, 'vedit', {});
        return false;
    }
}

2. 

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = 'vedit' then
  begin
    ShowMessage('!');
  end;

end;

 

Link to comment
Share on other sites

@SherzodThere's just one more detail left for me to finalize my dbgrid:
Is there any way I can pass a value to one of the roweditor fields via code, in the case of the example above, I wanted to send a value to the Field4 field via code, is there any way?
Something like "field(4).setValue" ? I can't do this!
Thanks again!

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...