Axapta: Edit form field values
If the field is bound to a datasource, you have to modify the value in the datasource. If the field is bound to a variable, then modify the value of the variable itself. It is the easy an smart way to do it.
You can modify the value in the form control by using the .text() method. (The control have to be the AutoDeclaration property set to Yes). This is a setter-getter (parameter) type method used in AX. If no parameter is passed, it is user as getter (read). If you pass a value, this is a setter (write).
Hope this helps.
Comments
-
Brad almost 2 years
Using a 'clicked' override on a button, I'd like to modify values in an Axapta form.
I'm able to get data from the form field using:
str strOld = Form_FieldName.valueStr();I'm able to prepend text to the field using:
Form_FieldName.pasteText(strNew);I can't seem to find a .clear method or .value= method. I'd like to replace the entire value in the field with new information.
Thanks
-
Brad over 14 yearsThanks for the help. When I use the .text(myValue) method, no exceptions are thrown, but nothing happens on the form either. The field is databound. Do you mind posting a bit of example code for modifying a value in the datasource? Thanks
-
j.a.estevan over 14 yearsIt whould be usefull if you post your own code with the exact problem you have. Datasource will be a table. You can make: Table.field = XX; element.redraw() //to refresh the form; Be carefull that this will modify the value in the database if you change the record (as usual in the standard)
-
Brad over 14 yearsThat worked perfectly. I'm just getting started in x++ after years of .NET. It's been a bit of a painful transition. I really appreciate your help.
-
j.a.estevan over 14 yearsGood luck with the learning. Syntax and philosophy is the same, just we have to fight with those tons of classes ;)