cancel
Showing results for 
Search instead for 
Did you mean: 

Need Complex Form Data Suggestions

ms1
Champ in-the-making
Champ in-the-making
Hello All,

I have a situation where I need to store 5 pieces of data for between 10-20 items. (So, 50 - 100 inputs in the the page.) For example, we want to upload 10-20 files and also data associated with those files. When the task is created, I will know how many files, but I am not sure how to best do this.

I have thought up several ideas and here are the two I think are best.
1) Use a custom form type. That sounds good, but we use external form rendering … so in my page, the custom type is just a string, so it will have to be parsed, values set in the inputs and then re-pack the strings on submit all via jQuery. Not really what I want to do, but it is a possibility. (Yes, I have successfully added my own form type and the values are visible in the page.)

2) Create 100 variables in the task and just use what is needed. (I am thinking that maybe I could add a create TaskListener and create the variables there instead of adding them all to the diagram.) This has the advantage that our standard form binding will work and I don't need to manipulate the form/submit with jQuery.

We are using Spring MVC with Thymeleaf to render pages.

What have others done in this situation?

TIA!
2 REPLIES 2

ms1
Champ in-the-making
Champ in-the-making
To answer my own question, any (serializable) objects can be put into local or global variables from a TaskListener. So, you can put a List or whatever in and use that to get data other than strings into your pages.

jbarrez
Star Contributor
Star Contributor
Correct. The variable types are pluggable to, you can inject a new VariableType to support complex objects in another way if serializable doesn't work.