cancel
Showing results for 
Search instead for 
Did you mean: 

custome form type values are null

cutout33
Champ in-the-making
Champ in-the-making
Hi,

am trying to create my own type


public class UserListFormType extends AbstractFormType {

   protected Map<String, String> values;
   
   public UserListFormType(Map<String, String> values) {
      this.values = values;
   }

   @Override
   public Object getInformation(String key) {
      if (key.equals("values")) {
         return values;
      }
      return null;
   }

   public static final String TYPE_NAME = "user_list";

   @Override
   public String getName() {
      return TYPE_NAME;
   }

   @Override
   public Object convertFormValueToModelValue(String username) {
      // TODO get the user object
      return username;
   }

   @Override
   public String convertModelValueToFormValue(Object lookup) {
      if (lookup != null) {
         return ((LookupModel) lookup).getKey().toString();
      }
      return null;
   }

}

I took the code fro enum form type, but the values are always empty if I use map constructor and null if I use empty constructor.
in my spring
   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">

      <property name="customFormTypes">
         <list>
            <bean class="com.aurorarnd.gxt.api.bpmn.types.UserListFormType">
               <constructor-arg name="values">
                  <map></map>
               </constructor-arg>
            </bean>
         </list>
      </property>

   </bean>
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
You're injecting an empty map in the constructor… What are you trying to reach with the map in spring? Do you want to configure a list (fixed list, set when type is created) of possible values to choose from in the UI?