Hi to all,
while browsing and looking for solutions to other problems, I noticed that there is no consensus or a general rule for how to access a formControl on a form.
I have seen solutions like the followings, all basically achieving the same:
FormControl frControl;
FormControl fdControl;
FormRun fr = this.formRun();
FormDesign fd = this.formRun().design();
str cName = formControlStr(MyForm, MyControl);
frControl = fr.control(fr.controlId(cName));
fdControl = fd.controlName(cName);
(Sorry, code looks ugly, but I don't understand how to make it work, markup language or other or mixed font usage do not work...)
What I wrote above might not be 100% syntax correct, depending if we are trying to get a control from a Handler, in a form extension or other, but the point is:
You can access a control on the form both from the FormRun or FormDesign class.
So here my question: is there a preferred solution? If so why?
And if there is not a clear preference, what are possible pros and cons of the two approaches, when making the choice?
I remember something like a form can have multiple designs so accessing through the FormDesign is not 100% safe, but I am not sure if it is something I read or just a false memory. I cannot find anything that helps me sort this doubt.
Thanks to all!