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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

String Edit : return Error Message if value not inserted in the Form Search bar

(0) ShareShare
ReportReport
Posted on by

please see the picture Below .........

There are 3 search Bars(3 String Edits ) ... The user Inputs value and then Presses the Search Button ...

→My requirement is that atleast 1 of these 3 String Edits must be Entered.. If all 3 are left empty

the user should get an error message upon Clicking the Search Command Button ..

What is the code for this?

6811.Capture.JPG

*This post is locked for comments

I have the same question (0)
  • axk Profile Picture
    925 on at

    Hi yasu,

    When clicking the "search" button, you have to retrieve value from all three controls. You can achieve this by calling value() method of every control (control's AutoDeclaration has to be set to Yes) and checking if at least one value is not empty. If no, throw error.

  • yasu Profile Picture
    on at

    Hi a -kow...

    Ya I totally understand the logic .... I figured that out aswell

    Do you know the code to write??

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Hi yasu,

    You can override clicked() method of search button and write something like 

    void clicked()
    {
        if (!textBox1.text() && !textBox2.text() && !textBox3.text())
        {
            throw error("At least one should be populated ");
        }

        super();
    }


    Where textBox* is a name of string edit control. Also all 3 should have autoDecleration property set to "yes" otherwise you won't be able to refer them in the code.

  • yasu Profile Picture
    on at

    Hi Miroshnikov

    thankyou very much ....  I will check it ,,,and will let you know

    thanks again

  • yasu Profile Picture
    on at

    Thankyou very mcuh .. it worked !!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans