submitting the values inside repeated grid in Array format

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

submitting the values inside repeated grid in Array format

bishnu.rath
Hi Team,

I have developed a form using orbeon form builder[PE trial version].

I have a scenario where I need to enter 3 possible answers for a question, I capture the answers through textbox, I designed the form using repeated grid component[refer image-1]. I am binding the "textbox" value with "/form/companyList/company".
When I submit the form through REST API , in the server end I am getting the  answer3 only. I am expecting the form to send all the answers. like [answer1, answer2, answer3]

form screenshot



Please help me to resolve this issue.

Thanks,
Bishnu
Reply | Threaded
Open this post in threaded view
|

Re: submitting the values inside repeated grid in Array format

Alessandro  Vernet
Administrator
Hi Bishnu,

Indeed, and I've reproduced the behavior you describe with the following form: scratch_10.xml.

Now, it is unclear to me what should happen in this case. The most straightforward thing to do would be to populate the node you point to with a space-separated list of values. But what if the company names have spaces? A service getting receiving "Acme Inc" wouldn't know if the user had 1 company "Acme Inc", or a first company "Acme" and a second "Inc". We'll give some thoughts about this internally, and I'll follow-up on this thread.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submitting the values inside repeated grid in Array format

Alessandro  Vernet
Administrator
Hi Bishnu,

A couple of things related to this:

- We updated the documentation to clarify the current behavior, which is that the value of the first control is used, in case multiple instance of that control exist.

https://doc.orbeon.com/form-builder/actions.html

- It isn't clear what the best way to deal with multiple controls is. Should the action create multiple copies of the node you point to, if that node is an element? Should it somehow combine the values, but then using what format? So our current recommendation is to create a control hidden to users (set its visibility to `false()`), that uses a calculation to combine the values the way you want, and to which you refer from the action. I hope this will work for you.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submitting the values inside repeated grid in Array format

bishnu.rath
Thanks a lot Alessandro for your reply. Like you suggested, I am using a hidden field that joins all the answers using pipe symbol.
Reply | Threaded
Open this post in threaded view
|

Re: submitting the values inside repeated grid in Array format

Alessandro  Vernet
Administrator
Got it, I'm glad that solution works for you, and thank you for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet