Checkbox Prepopulate using http service

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

Checkbox Prepopulate using http service

nkvangip
We have created a form using the form builder and the form has a section with bunch of check box options.  We have an http service that
will return list of values based on which we have to decide whether to check/uncheck the check boxes.  Below are screen shots showing
the checkboxes in the forms and also screen shot of the action that i am trying to use to determine if checkbox should be checked or not.



The problem with the action that i have defined is that the form runner is replacing my whole checkbox selection with only the list that i am


sending back from the service.  For example i want First Choice and third choice selected the http service will be returning

<checkboxList>
                <label>First Choice</label>
                <value>1</value>
        </checkboxList>
        <checkboxList>
                <label>Third Choice</label>
                <value>3</value>
</checkboxList> 

And when i generate a form the section is now just showing First choice and third choice and the check box are not selected.  But the requirement is that I should see all the four choices and based on the service values i should see the first and the third choice selected.  Can you please suggest if there are any other alternate approaches to fulfill this requirement?
Reply | Threaded
Open this post in threaded view
|

Re: Checkbox Prepopulate using http service

Alessandro  Vernet
Administrator
Hi Naveen,

In the Actions Editor, your screenshot doesn't show that part, but I imagine that you used the section "Set Response Selection Control Items". That part is for replacing the choices the user can make, not the choice(s) she made. It seems you're aiming for the latter, so you should use "Set Response Control Values", and in your case the XPath expression should return "1 3", if you want the first and third item to be checked. So you can either change the service to return that, or make the expression be string-join(/test/checkboxList/value, ' '). You'll let us know if this works for you,

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

Re: Checkbox Prepopulate using http service

nkvangip
In reply to this post by nkvangip
Yes that is what I did and it worked like a charm.  Thank you very much for a timely suggestion.  Appreciate all your support
Reply | Threaded
Open this post in threaded view
|

Re: Checkbox Prepopulate using http service

Alessandro  Vernet
Administrator
Naveen, excellent, I'm glad this helped, and thanks for the update.

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