Mandatory Fields

Hi,

I have create my own form in AX 2009. Also bind it with my own Data Table.

There is a stringEdit control on this form which is bind to the DataMethod which is declared under the Form’s datasource’s datatable.

I have set the Mandatory property of this stringEdit control on the form to “YES”.

Now the problem is when i close the form without entering any value in this stringEdit control, it allows me to close the form. But the desired result is the control does not allow me to close the form without entering any value in the stringEdit control.

Please advice to come out this problem.

Thanks & Regards,

/Ashlesh

Hi

i don think its possible to make a method field mandatory as it does not store any value on the first place and its just a display field.

Hi,

I can not set the property “Mandatory=Yes” of the stringEdit control on the form?

please advise.

Regards,

/Ashlesh

Hi Shon,

can you please tell me what steps do i required to perform to simply implement the mandatory field on the form, which is directly bind to the Table field(Not the datamethod)?

What i have done in the test environment is,

  1. i have created a simple table with a single string type filed (without any EDT assigned) and set its Mandatory property to YES.

  2. Then create a simple form with only one control StiringEdit and set its Datasource property to the Datasource in the step 1 and the DataField property to the field of the table of step 1.

  3. Now run the form, it shows the stringEdit control field with the red highlighted but if i close the form without entering anything in the control it allows me to close the form. It has dont even warn me for the mandatory field.

Can you please suggest me some ways.

Thanks & Regards,

/Ashlesh

Hai Ashlesh,

Add one more field and put some values and run the form w/o filling ua mandtory field.

It will work [Y]

Regards

Shon

Hi Shon,

Thanks for your help.

/Ashlesh

Even though it allows to close you the form - the system will not write this record until the mandatory fields are filled.

hi,

create validateWrite() method on table you have created.

in this method write code to check return value of method which is associated with your stringEdt control, depends on that return value return TRUE or FALSE.

this will give you desired result.

Thanks & Regards,

Mehul Thacker.