Hi all,
I am trying to build a form that allows users to input the first and last name text fields in Forms Builder 6.7 SP3 P15.
When either of the value changes in the above, use a custom adaptor to concatenate the values and populate to a third full name text field.
I am trying to implement the above functionality using custom ISetValueAdaptor, with a simple Java class and deploying to Webtop.
I have also included screenshots of my adaptor configuration, as well as the Special tab of the third full name text field (named as "staff_name").
The class seems to be called whenever values are changed in either the first or last name fields, but it looks like I am unable to get the parameters argument.
Kindly guide me on this implementation.
My code below:
public class FullNamePopulatorAdapter implements ISetValueAdaptor {
@Override
public Object execute(IAdaptorParameter[] parameters) throws AdaptorException {
String firstName = "";
String lastName = "";
String fullName = "";
if (parameters != null && parameters.length == 2) {
IAdaptorParameter parameter = parameters[0];
if (parameter.getObject() instanceof String) {
firstName = parameter.getObject() == null ? (String) parameter.getObject() : "";
firstName = firstName.trim();
}
parameter = parameters[1];
if (parameter.getObject() instanceof String) {
lastName = parameter.getObject() == null ? (String) parameter.getObject() : "";
lastName = lastName.trim();
}
}
if (!firstName.isEmpty() && !lastName.isEmpty()) {
fullName = lastName + " " + firstName;
} else if (!firstName.isEmpty()) {
fullName = firstName;
} else if (!lastName.isEmpty()) {
fullName = lastName;
}
DfLogger.info(CLASSNAME, "firstName = " + firstName + ", lastName = " + lastName + ", fullName = " + fullName, null, null);
return fullName;
}
}