Update parent form subTitle from inner WrappedFormField values [message #1856329] |
Sat, 03 December 2022 14:20 |
J D Messages: 103 Registered: February 2021 |
Senior Member |
|
|
Hi there everyone,
I am using the WrappedFormField demo (https://scout.bsi-software.com/widgets/?dl=widget-wrappedformfield) as a template for one of my forms.
I basically have a parent form that calls some other form in a wrapped form field just like in the demo.
I would like to update the parent form's title tab based on the field values in the wrapped form field.
For example, I have the following method in the wrapped form for creating the subtitle from the first name and last name entered in the wrapped form's fields.
protected String calculateSubTitle() {
return StringUtility.join(" ", getFullNameBox().getFirstNameField().getValue(),
getFullNameBox().getLastNameField().getValue());
}
When I call this method from the form handler's execStore() method, it throws a NullPointerException even though the fields are not empty and the data was correctly saved!
Can anyone please show me what I;m doing wrong?
Thanks a lot for your kind assistance.
JD
[Updated on: Sun, 04 December 2022 08:38] Report message to a moderator
|
|
|
|
Re: Update parent form subTitle from inner WrappedFormField values [message #1856389 is a reply to message #1856329] |
Thu, 08 December 2022 10:07 |
|
I don't fully understand how your code is structured, but basically this should be possible. However, you have to be careful at what point in time you call those methods, since the WrappedFormField manages the lifecycle of the inner form and might already have closed it.
I suggest setting a breakpoint and inspecting what exactly is null. The "getXyzField()" methods are nothing special. They go to the parent group box and simply find fields based on their type. You either have the wrong group box (check your imports) or the fields are already disposed (can happen during form close).
Regards,
Beat
|
|
|
Powered by
FUDForum. Page generated in 0.03637 seconds