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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Validation on key press in form string control(existing form)

(1) ShareShare
ReportReport
Posted on by 36

Dear Guys,

I need a validation method to be done when a key pressed on a text field in a form. This is used for tracking number in edit packingslip form.No action done, while on key press . When we moves the pointer from that field to another then only the validation starts. Without using any tab or enter, while we hit any key, the validation should be active. Pl. give me the solutions.

 

Here is my code for your reference.

 [FormControlEventHandler(formControlStr(CustPackingSlipJourEdit, CustPackingSlipJour_ShipCarrierWaybill), FormControlEventType::Validating)]
    public static void CustPackingSlipJour_ShipCarrierWaybill_OnValidating(FormControl sender, FormControlEventArgs e)
    {
        FormRun              formRun;
        FormStringControl    fsc;
        //int                strlen; 
        //int                startPosition;
        formRun = sender.formRun() as FormRun;
        fsc = sender.formRun().design().controlName(formControlStr(CustPackingSlipJourEdit, CustPackingSlipJour_ShipCarrierWaybill));
        str controlValue = fsc.text();              
        TextBuffer txt = new TextBuffer();
        txt.setText(controlValue);
        txt.regularExpressions(true);
        if(!txt.find("^[0-9]+$"))
        {
            throw error("@DT:TrackingNumber");
        }        
     
    }

Thanks in Advance,

Prasad N.

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    304,504 Super User 2026 Season 1 on at
    Hi Prasad,
     
    What version of Dynamics are you using? It is correct that the OnValidation will be called when leaving the field. Then it knows the complete string and can validate it as a whole. In case you want to act during typing, you can try to override the form control method TextChange.
  • PN-21051232-0 Profile Picture
    36 on at
    Hi Andre,
     
    Thanks for the reply ,but i want this functionality in existing form control. There is no text change method .
    How i will do can i create the extension class for that method.
    could you please post sample code for that .
     
     
     
    Thanks & regards,
    Prasad N.
  • Martin Dráb Profile Picture
    239,364 Most Valuable Professional on at
    Moved from Dynamics AX forum.

    I suspect this isn't supported in F&O.
  • André Arnaud de Calavon Profile Picture
    304,504 Super User 2026 Season 1 on at
    Hi Prasad,

    Can you confirm if you are using Dynamics 365?
  • PN-21051232-0 Profile Picture
    36 on at
    Hi Andre,
     
     
    Yes i am using D365 F&O.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 694

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 646 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 337

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans