TWebDBCheckbox bugs

Hi,
I have encountered a couple of issues with the TWebDBCheckbox component (Latest release 2.8.3.0).
First bug:
The current behaviour of the checkbox doesn't allow me to use the new value immediately after it has been set. The underlying field value is set ONLY on Post method of TwebClientDataset, it doesn't seem to always post as soon as a change happens, as other Dbeditors does.
This is a big problem, and cause errors, especially when Standalone Editors are syncronized with grids.
Second Bug:
When working with a WebDBCheckbox connected to a TStringField (ValueChecked = S, ValueUnchecked = N) and the same dataset is connected to a FNCDataGrid (with relative adapter), I get "Cannot set properties of null (setting 'myfield')" when posting or navigating to a new record. It seems that adapter don't works well in this situation.
Thanks

Are there news on these issues?
While the first problem can be easily worked around, the second one is harder to deal with since it’s related to simply having the TWebDBCheckbox bound to a TStringField and it’s not caused by conflicts with other components ( apparently ).

For reference, this is the error that shows up in the console:

Uncaught TypeError: Cannot set properties of null (setting 'availStr')
at Object.SetJSONDataForField (jsondataset.pas:1110:3)
at Object.SetJSONDataForField$1 (jsondataset.pas:1072:3)
at Object.SetFieldData$1 (jsondataset.pas:1860:15)
at Object.SetFieldData (db.pas:4058:3)
at Object.SetData (db.pas:6015:11)
at Object.SetAsString (db.pas:6311:3)
at Object.EditingChanged (WEBLib.DBCtrls.pas:2288:26)
at Object.cb [as FOnEditingChanged] (rtl.js:256:1)
at Object.EditingChanged (WEBLib.DBCtrls.pas:1153:5)
at Object.CheckActiveAndEditing (db.pas:7827:5)

availStr is a TStringField and the DataSet is active and has data.

I tested this here with a TMSFNCDataGrid and TMSFNCDataGridDatabaseAdapter on the form connected via a TWebDataSource to a TWebClientDataSet initialized with the code:

begin
WebDBCheckBox1.DataField := 'Checked';
WebDBCheckBox1.ValueChecked := 'T';
WebDBCheckBox1.ValueUnChecked := 'F';

WebDBEdit1.DataField := 'Name';

webclientdataset1.FieldDefs.Add('Checked', ftString);
webclientdataset1.FieldDefs.Add('Name', ftString);
webclientdataset1.CreateDataSet;

webclientdataset1.Active := true;
webclientdataset1.Insert;
webclientdataset1.FieldByName('Checked').AsBoolean := true;
webclientdataset1.FieldByName('Name').AsString := 'Paris';
webclientdataset1.Post;

webclientdataset1.Insert;
webclientdataset1.FieldByName('Checked').AsBoolean := false;
webclientdataset1.FieldByName('Name').AsString := 'London';
webclientdataset1.Post;

end;

I can edit, modify, check / uncheck the checkbox here without issue.
Can you please provide sufficient details & exact steps for reproducing this?

Upon further testing I discovered that problem seems to be related to empty string values:

  • Having either CheckedValue or UncheckedValue be an empty string causes an error;
  • With both CheckedValue & UncheckedValue valorized, navigating on a record where the related field doesn’t yet have a value causes an error;

I’m attaching a little demo here:

Dataset Test Proj.zip (61.8 KB)

The checkbox with label ‘Available Str’ is the one bound to a string field.

The checkbox with label ‘Available’ is the one bound to a boolean field.

I know this falls into triple-state checkbox territory, but adding options to better handle this behaviour from inside the component would be of great help.

I’m sorry but it is unclear what is expected to do in this demo to see an issue.
For the checkbox with label ‘Available’ , the DataField is not set, so it isn’t bound to any field and therefore is disabled. For the checkbox with label ‘Available Str’, I can navigate the grid and no errors happen on this checkbox and I can toggle this checkbox and there is no error either.

I can only assume this is not the latest state of your sample project.

So, please, properly finish this demo and provide clear step by step instructions for reproducing an issue.

Demo New.zip (61.0 KB)

Here’s a simpler demo.

I’m also attaching a short screen-recording of the other issue mentioned in the demo.

Thanks
We applied improvements that will be included in the next release.

1 Like

Thank you for fixing that issue but it seems like there’s another, possibly bigger, one.
The OnClick event doesn’t fire unless you click on an empty space inside the main <span>.

See the attached demo:

Checkbox.zip (56.6 KB)

Thanks for informing.
We've applied an improvement for this that will be included in the next update.