Hi,
I have a checkbox in a form and I want to uncheck the checkbox when a certain field got modified.
How can I uncheck a checkbox in code?
Hi,
I have a checkbox in a form and I want to uncheck the checkbox when a certain field got modified.
How can I uncheck a checkbox in code?
Hi,
You should try yourField = noyes::no
hope it helps
regards,
Thomas
Thanks for your answer.
Can you tell me as well how I can call that code through a button?
Like, I created a Button on the form and now I want the checkbox to uncheck when that button is clicked.
Am I right that I have to override the clicked method?
If so, how can I retrieve the current selected record on the form?
on the clicked method:
yourField = noyes::no;
yourFormDatasource.refresh();
ex: inventTable_ds.refresh();
regards
Okay, thank you so far, but I have still one problem now.
I have 2 Tables, let’s say Table1 and Table2. Table2 is the line of Table1. So, when I select a record of Table1, the respective records of Table2 which belong to Table1 are shown in a 2. grid.
The checkbox is in Table2.
Now, I want that if I select a record from Table1 and click the button, all the respective records in Table2 will get uncheck.
With your code it only works when I select a record in Table2 and only that record will get uncheck.
write the below code in the clicked method.
void clicked()
{
Table1 table1;
Table2 table2;
ttsbegin;
while select forupdate table2 where table2.field1 == Table1.field1
{
table2.checkbox == noyes::no; /// checkbox is ur check box field
}
ttscommit;
Write this in form new method.
void checkBox()
{
Table1 table1;
Table2 table2;
ttsbegin;
select forupdate table2 where table2.field1 == Table1.field1;
if(table2)
{
table2.checkbox == noyes::no; /// checkbox is ur check box field
table2.update();
}
ttscommit;
Design -->Button → method–> clicked method
After super();
element.checkBox();
try this , it works, all the best