3

For a check box I am trying to set the default value to checked.

I set the value in the properties to 1
Didn't appear checked by default.
Restarted AOS, did Full compile and CIL generation.
Still no luck.

Any Ideas what I am missing?

j.a.estevan
  • 3,057
  • 18
  • 32
Cjconry
  • 58
  • 1
  • 1
  • 6
  • After setting the value property to 1 and saving your changes, try going to the form in the AOT, right-click -> Restore – SShaheen Mar 04 '13 at 19:30
  • I tried this, didn't seem to make a difference. What would have been the point of hitting restore? – Cjconry Mar 04 '13 at 21:01
  • Sometimes when you make changes to a form, they won't show up until you restore because of caching. I would think that if you restarted the AOS and compiled and generated CIL it might take care of that, but I figured it wouldn't hurt to try. – SShaheen Mar 04 '13 at 21:06
  • Thanks for the help, I cleared the AUC files in my app data to clear my local cache. Im going to restart and compile tonight. – Cjconry Mar 04 '13 at 21:12
  • Sadly a full compile, CIL generation and Flushing the cache still haven't worked. – Cjconry Mar 06 '13 at 18:31

3 Answers3

1

Try inputing the value to 1 in the run method or classDeclaration with the FormCheckBoxControl method.

[checkbox value] = FormCheckBoxControl.checked(1);

sycojason
  • 26
  • 2
  • Thanks for the response. I tried your method `FormCheckboxConrol CBC; CBC = isDeposit; CBC.checked(1);` Still doesnt work. If it helps i am using the CustPaymEntry form, and the isDeposit checkbox. – Cjconry Mar 04 '13 at 18:57
  • Is CBC just a local property you are declaring? If your checkbox control is under the Designs node in the AOT, set the AutoDeclaration property to Yes and use that checkbox by name to set the value (i.e. `.checked(1);`) – SShaheen Mar 04 '13 at 19:33
  • CBC was assigned to isDeposit which is in the design node – Cjconry Mar 04 '13 at 21:02
  • 1
    The `isDeposit.checked(true);` Method did work, I just had to place it in at the end of the run() command – Cjconry Mar 06 '13 at 19:58
1

If control is not directly bound to the datasource record, instead of this:

ctrl.checked(true);

use this:

ctrl.value(true);
0

If the checkbox is linked to a DataField, you should put the default value on the initValues method of the Data Source:

tableName.fieldNoYes = NoYes::Yes;

If the checkbox is not linked to data, you can check it on the run method (after super() call) of the form (assuming the control has the AutoDeclaration property to Yes.

CheckBoxControl.checked(true);
j.a.estevan
  • 3,057
  • 18
  • 32
  • CheckBoxControl.checked(true) doesn't work, at least on AX 2012 R3: to make it work one has to use value() method, as suggested by @user5659883. – Simone Mar 14 '19 at 10:34