How to pass JSON values from form to process variable

1
0
-1

Hi,

I'm using bonita 7.2.3. I created a custom widget, to obtain a table with a column that contains checkboxes to get row selected. I created also in the form page a JSON variable to collect values checked in the table. The variable is correctly populated and on page submit I need to transfer those values to a process variable (the type is java.util.List) I defined in the process.
Contract variables can't be defined as List, so how can I pass values from page to variable? Using a text contract variable, I obtain an error message as JSON cannot be assigned to TEXT.

Any suggest would be appreciated.
Thank you

2 answers

1
+1
-1
This one is the BEST answer!

I solved my problem.
The way is to pass JSON as string.
In formOutput it can be done by using JSON.stringify($data.myJsonData)

1
0
-1

Hello @michele.pantano,

sorry about asking, but im doing a process who uses a table that will need a checkbox in the first row,
can u help me coding that custom widget?

Thanks.

Comments

Submitted by michele.pantano on Thu, 04/06/2017 - 11:33

sure. Please explain your question, thanks

Submitted by lucashort7 on Thu, 04/13/2017 - 21:01

Sorry for answering later... i was busy at work

Im with this code so far:

<div class="table-responsive">
<table class="table table-striped">
    <thead>
        <tr>
            <!--<th></th>-->
            <th class="ng-binding ng-scope" ng-repeat="header in properties.headers"> {{header}}</th>
        </tr>
    </thead>
    <tbody class="ng-scope">
        <tr class="ng-scope" ng-repeat="row in properties.content">
            <!--<td><input type="checkbox" class="checkbox"/></td>-->
            <td class="ng-binding ng-scope" ng-repeat="column in properties.columnsKey track by $index">{{column}}</td>
        </tr>
    </tbody>
</table>
</div>

Problem: i really cant get the data into the rows, im doing something wrong with the column keys and content input, what am i doing wrong?
here a pic of the entire widget:
http://imgur.com/a/Vhbpt

Notifications