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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Capturing Modified Value of A dynamic check box from a form

(0) ShareShare
ReportReport
Posted on by

Hello Everyone,

We have a form in which we are creating dynamic text boxes and checkboxes if they meet a certain criteria. Below is the part of the code i'm using

while select TableRow where TableRow.Value == ReqIntValue

{

formStringControl = TestString.addControl(FormControlType::String, int2Str(ReqIntValue));

formStringControl.label(TableRow.ValueDesc);

formstringcontrol.widthMode(3);

formstringcontrol.multiLine(true);

formstringcontrol.autoDeclaration(true);

FormCheckBoxControl = TestString.addcontrol(FormControlType::CheckBox,int2Str(ReqIntValue)+'IsNoNE');

FormCheckBoxControl.label("Is None");

this.controlMethodOverload(true);

}

Now We want to achieve a functionality which would be implemented by this code below if all the control names were hardcoded individually

[Control("CheckBox")]

class CheckboxControlName

{

public boolean modified()

{

boolean ret;

ret = super();

if(CheckboxControlName.value == true)

{

FormStringControl.text('None');

}

return ret;

}

}

However the functionality we would desire to have is to have to write this method only once and be able to use for all the checkbox controls that are formed by the first part of the code.

Regards,

Hitesh.

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Could you consider using a grid instead of adding these controls dynamically? That way you wouldn't need to do any special tricks.

  • Community Member Profile Picture
    on at

    HI Nikolaos,

    there are a lot of string fields that have to be displayed on the form

    and are different each time depending on a particular condition

    Using a grid wouldn't be an ideal case scenario

    is there any possibility where we can declare a dynamic form control class instead which would pick the name of the control and then perform the method written inside it

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Hitesh,

    You can use the event handler approach

    ... 
    FormCheckBoxControl = TestString.addcontrol(FormControlType::CheckBox,int2Str(ReqIntValue) 'IsNoNE');
    FormCheckBoxControl.OnModified  = eventhandler(this.onCustomModified);
    ...
    
    public void onCustomModified(FormControl _sender, FormControlEventArgs _eventArgs)
    {
        //Do stuff
    }

  • Community Member Profile Picture
    on at

    Thank you BR, Sergei

    That was precisely the functionality I was looking for.

    Thanks Nikolaos for the input.

    Regards,

    Hitesh

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans