Orbeon Forms: Split Text into Control Fields

38 Views Asked by At

We are pasting the following text into a Plain Text Area control:

{ "FIELD1":VALUE1, "FIELD2":VALUE2, "FIELD3":VALUE3, "FIELD4":VALUE4 }

Then we need to unpack this data into separate fields within the form.

How can we achieve this?

Many thanks in advance.

PeteA

2

There are 2 best solutions below

1
avernet On BEST ANSWER

If the user-entered value is in JSON format, you can also use the xxf:json-to-xml() function, which makes this both easier and more robust.

See the function in action

For reference:

  • The two fields to the right of the text area use the expressions xxf:json-to-xml($json)/json/author and xxf:json-to-xml($json)/json/date.
  • The source for this form is available here.
0
Pete Atkin On

See last explanation above using a Calculated Value formula.