Dynamic list of prefilled editable fields

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

Dynamic list of prefilled editable fields

Geert
Hi,

we are still on version 2016.1 but are planning to migrate to version 2017.1 very soon. :-)

we have to develop a form that uses a rest service to generate a list of prefilled editable fields.
(just like a repeated grid without the possibility to add extra rows, only edit existing ones)

We're still on version 2016.1 and it cannot be done using form builder.
Writing an XForm by hand to accomplish this is quite cumbersome.

Will there be support for this kind of functionality in form builder in the near future?

Regards,
Geert
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Alessandro  Vernet
Administrator
Hi Geert,

Yes, yes, and yes. ;) This is one of top-RFEs, and we really hope that we'll be able to implement it soon, but until the code is written, I don't want to make any promises.

https://github.com/orbeon/orbeon-forms/issues/1298

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

Re: Dynamic list of prefilled editable fields

Geert
Hello Alessandro,

I've noticed that is feature has been added to the backlog (release 2017.2).

Will this feature actually make it in the next release?
And do you have some timing when this version will be available?


Kind regards,
Geert




--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Alessandro  Vernet
Administrator
Hi Geert,

This might be our most requested RFE, however it's likely we won't get a
chance to work on this in the next month of so, and so it most likely won't
make it in 2017.2, but I've already marked it for consideration for 2017.3.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Geert
Hi Allessandro,

we've implemented a form (XForms instead of Form builder) to generate a list
(html table with non-editable fields) that is the result of a rest service
call (request parameter as input). Everything works as expected but we are
still experiencing some problems when generating the pdf.

When we use the standard PDF action everything works just fine. But when we
try to generate the pdf based on the persisted data, our list is empty
(while all the other fields are available in the pdf.)

I assume that this is caused due to the fact that the pdf generator tries to
re-execute the service call but can't find the request parameter needed to
call the rest service.

The parameter that is used as input for the rest service is also available
on the form in a read only 'edit field' (firmNumber). And is still available
while generating the PDF.

So, it is not really necessary to use the request parameter as input for our
service. I guess it should be possible to use the value of this input field
but I can't figure out how this can be done.

So, it's actually the request parameter
({xxx:get-request-parameter('firmNumber')} that should be a reference to an
input field that is the result of another service call.

   
<xf:instance id="EmployeeService-instance"
xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                     
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder">&lt;params/&gt;</body>
                                 </xf:instance>  
                  <xforms:send event="xforms-model-construct-done"
submission="EmployeeService-submission"/>
               
                  <xf:submission id="EmployeeService-submission"
                         
resource="http://ourdomain:6331/orbeonformsservice/api/firm/{xxf:get-request-parameter('firmNumber')}/employees"
                           method="get"
                           serialization="none"
                           mediatype="none"
                           replace="instance"
                           instance="EmployeeService-instance"/>


Geert







--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Alessandro  Vernet
Administrator
Hi Geert,

I am not sure to follow completely. You're saying your service runs again
during PDF generation, but that this doesn't work because it uses a request
parameter, which isn't available at that time. Is that correct? You're
suggesting that the value of that request parameter is stored in a field,
and that you could refer to that field, instead of the request parameter.Why
isn't that working, if I understand things correctly?

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Geert
Hi Alessandro,

you're correct. That is exactly what I'm trying to accomplish. I tried it as
follows but perhaps this is oversimplified  :-)


<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all"
xxf:index="id">
        <form>
              <section-1>
                      <firmNumber/>
...

  <xf:submission id="EmployeeService-submission"
                 
resource="http://ourDomain/orbeonformsservice/api/firm/{instance('fr-form-instance')/form/section-1/firmNumber}/employees"
                           method="get"
                           serialization="none"
                           mediatype="none"
                           replace="instance"
                           instance="EmployeeService-instance"/>


I have another question within the context of this form.
I'm still trying to make a repeated list of editable fields.


While I'm looping I'm creating input field using the xforms:input tag.
Example
     <xforms:input ref="firstName"/>
     <xforms:input ref="lastName"/>
....

The input fields are visible, prefilled and editable, but when the form is
submitted, the data is not saved into the database. Neither are these fields
available on the generated pdf.
Can you provide a simple example about how to declare a dynamically created
inputfield so that it will be persisted. (and available on the pdf).


Thanks in advance.
Kind regards,
Geert

 


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Alessandro  Vernet
Administrator
Hi Geert,

Your submission making a reference to the field value looks right to me. Is
the service called at all? If it is, I assume that the correct value isn't
passed to the service? Do you see an error message in the `orbeon.log` when
this happens?

About creating multiple input fields, how are you doing this now? The
Repeated Grid would be the typical construct through which this is achieved.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Geert
This post was updated on .
Hi Allesandro,

First of all. Thank you for the swift reply.
To sum things up. All my tests are based on following service call.


<xf:instance id="CountryService-instance" xxf:exclude-result-prefixes="#all">
        <body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                  xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xforms:send event="xforms-model-construct-done" submission="CountryService-submission"/>
<xf:submission id="CountryService-submission"
                           resource="http://ourDomain:6312/cbservices/referencecodeservice/api/countries?language={xxf:get-request-parameter('lng')}"
                           method="get"
                           serialization="none"
                           mediatype="none"
                           replace="instance"
                           instance="CountryService-instance"/>
               
           
In my original test I created a standard html table including xform input
fields.


<xf:repeat id="country-repeat" ref="instance('CountryService-instance')/*">
        <xf:input id="countryCode" ref="countryCode" incremental="true"/>
        <xf:input id="countryName" ref="countryName" incremental="true"/>
</xf:repeat>


On screen it looks ok, the input fields are prefilled based on the result of
a rest service call. (see attached screenshot). But when the form is
submitted, the data isn't send to our backend service. The xml does not
contain the data. Neither is the pdf generated correctly.

<http://discuss.orbeon.com/file/t375488/screenshot1-service-call-table.jpg


As you suggested I did some tests with the repeated grid.

My first test used a plain repeated grid, using the form builder (not even
trying to integrate a rest service call.) After submitting the form, the
'repeated' input fields are available in the xml that is sent to our backend
service. Great! But the repeated grid isn't available in the generated pdf
(only the headers are visible).


Finally my last test. (Also the functionality needed for our business case.)
I tried to pre-fill the repeated grid by calling the same rest service as in
my original test (directly in the XForms definition since Form builder does
not support this functionality).
A repeated grid is visible (see screenshot), a number of lines is added
automatically (number of items found in the iteration)  but I don't know how
to incorporate the individual input fields.
I've included the xform as well. All help (or a very simple basic example)
is highly appreciated.

<http://discuss.orbeon.com/file/t375488/screenshot1-service-call-grid.jpg

test_form_repeated_grid.xml
<http://discuss.orbeon.com/file/t375488/test_form_repeated_grid.xml





--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Alessandro  Vernet
Administrator
Hi Geert,

The data from that table isn't submitted because it isn't in the
`fr-form-data` instance.

You're saying that when using a repeated grid, that grid doesn't show in the
PDF. Are you filling the repeated grid based on the result from the service?
If you are, does that mean that you're creating the relevant iterations in
the `fr-form-instance` instance? From what I can see in
`test_form_repeated_grid.xml`, the repeated grid still points to
`CountryService-instance`, so any change done by users won't be persisted,
and won't be visible in the PDF, which would explain what you're seeing.

What you would really need is for  RFE #1298
<https://github.com/orbeon/orbeon-forms/issues/1298>   to implemented. Short
of that, you could write XForms that, upon getting a result from
`CountryService`, creates the appropriate "rows" in `fr-form-data`, and
copies the values from `CountryService-instance` to `fr-form-instance`. And
of course, just let me know if you need any help with that.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Geert
Hi Allessandro,

how can this be done based on the XForm I've attached in my previous post.
My knowledge of XForms syntax is rather limited so I didn't manage to get
this to work.

Kind regards,
Geert

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic list of prefilled editable fields

Alessandro  Vernet
Administrator
Hi Geert,

Here is the  source of a form
<https://gist.github.com/avernet/dc3bcaefd1c1fd7df9022834a83767c4>   that
shows how it can be done. I created an HTTP service, `get-states`, and an
action that runs this service when the form loads. The interesting part is
in custom code added to the form that listen on the service having run, and
insert iterations in `fr-form-instance`:

<xf:action observer="get-states-submission" event="xforms-submit-done">
    <xf:var name="states"
value="xxf:instance('fr-service-response-instance')"/>
    <xf:action iterate="$states/state">
        <xf:var name="state" value="."/>
        <xf:insert
           
context="xxf:instance('fr-form-instance')/states-section/states-grid"
            ref="states-grid-iteration"
            origin="xxf:element(
                'states-grid-iteration',
                (
                    xxf:element('abbreviation',
$state/@abbreviation/string()),
                    xxf:element('name-en', $state/@name/string()),
                    xxf:element('name-fr', $state/@name-fr/string())
                )
            )"
        />
    </xf:action>
</xf:action>

I hope this helps,

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet