web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Mandatory property set as yes not working for a form control which is not linked to data source

(0) ShareShare
ReportReport
Posted on by 97

i have a date field in my form  which is set as mandatory using property but only red line appears when i click any othedr place it does not show any error or warning message

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    Did you set it on the form control? It should be done on the table or form data source level.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    299,149 Super User 2025 Season 2 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    Hi Palak,

    In case it is an unbound control (as I understand from the title) , you have to write your own validation logic. The mandatory part will be checked upon saving a record for database fields.

  • Palak jain Profile Picture
    97 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    i wrote this validation logic. 

    The field name is CopyOfdialogDateFrom which is a date field i have set its property as mandatory but as this field is not bound to any datasource the mandatory property is not working 

    this is my form, i have a requirement such that the date field should be mandatory.

    If i click on find button  without entering any value in the date field it should flash up with an error.

    61860.Capture1.PNG

    public boolean validateWrite()
    {
    boolean ret;
    if (!CopyOfdialogDateFrom)
    {
    ret = checkFailed("field must be filled in");
    }
    //ret = super();

    return ret;
    }

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    You should add your validation logic on clicked() method of Find button.

    void clicked()
    {
        super();
    
        if (!CopyOfdialogDateFrom.valueStr())
        {
            checkFailed("field must be filled in");
        }
        else
        {
            //your code
        }
    }


  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    So add this code to button click or to the function behind the button instead of validatewrite

  • Palak jain Profile Picture
    97 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    thanks it worked

  • Palak jain Profile Picture
    97 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    getting another issue as the field is mandatory and if i fill the field with some value and then clear it and then click on find it displays 2 error messages

    1. the system's message

    2. the message i printed via code

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    Just remove all your old validations regarding this field and put your validation only in the button click.

  • Palak jain Profile Picture
    97 on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    But what if i want the mandatory red line in that particular control??

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Mandatory property set as yes not working for a form control which is not linked to data source

    Just set property Mandatory to true.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans