How I can relate different forms fields?

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

How I can relate different forms fields?

RSS87
I'm trying to link two different forms fields, but do not know how I can get it.

Please could you help with this problem. The scenario is as follows:

I have two forms. I need the value type in the field "A" in the first form, is displayed in the "B" the second form.

Is this possible?
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Hank Ratzesberger-3
Hi,

I think it is possible.  One issue is that the readonly attribute is
applied to the instance, so if you only want the value to appear (in
an input control) then I think you need two instances, with the B
instance the element is readonly.

If you just want to display the value, you can use the <fr:output> element.

One way is to have the value in B calculated -- if you have two instances:

<bind nodeset="instance('B-instance')/B" calculate="instance('A')/A"/
readonly="true()"/>

I hope that gives you some ideas to try.

--Hank


On Thu, Oct 17, 2013 at 6:58 AM, RSS87 <[hidden email]> wrote:

> I'm trying to link two different forms fields, but do not know how I can get
> it.
>
> Please could you help with this problem. The scenario is as follows:
>
> I have two forms. I need the value type in the field "A" in the first form,
> is displayed in the "B" the second form.
>
> Is this possible?
>
> --
> View this message in context: http://discuss.orbeon.com/How-I-can-relate-different-forms-fields-tp4657489.html
> Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.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].



--
Hank Ratzesberger
XMLWerks.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: How I can relate different forms fields?

RSS87
Hi,


I think that your approach is for 2 fields of the same form. But I have two forms, and I need to show the value of the field in the first form, to the second form.

Somebody can help me please..

Thanks
Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Jez
Hi

Can you explain how the forms are related? Ie, which of of the first form's data instances you want the A value to show in which of the second form instances' B value? Is there a "foreign key"?

Regards

Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

RSS87
Hi,

I  do not know how the forms are related, that is my issue...

Imagine that in the first form, we have a field "name" and we want to display that value in other field called "user" in another form.

Is it possible?

Regards
Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Jez
Hi

I meant how is the data related? What is your requirement?

Say you've created 3 first form instances "Joe Bloggs", "John Smith" and "Elizabeth Windsor"

Which value do you want to show as User in the second form and why? Or potentially do you mean all of them?
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

RSS87
Hi,

This is the issue:


In the first form, I have four fields:

- First Name
- Last Name
- City
- Age

In the second form, I have two fields:

- First Name
- Telephone

I need obtain the value introduced in the first form field "First Name", and display it in the second form field "First Name".

Thanks for your time
Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Jez
I'm still not sure of your requirement. Could you please describe what actual functionality you are after, rather than just saying you have a number of fields in each form.

I take it you are using the first form to capture a number of "people" records. What are you doing in the second form? Fixing a one-to-one telephone number against the "person" record? Or wanting to associate more than one telephone number? Or associate the telephone number of the agent representing the "Person"? Is the second form a White pages directory of some sort? Do you want to link back to the person record from the telphone number?

Say you've got 100 instances of the first form data - are you wanting to display 100 rows in the second form? Or choose one?

I appreciate it might be obvious to yourself but depending on how you want to use the data will affect the data model and therefore the solution.

Regards

Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

RSS87
The example above is only a example not a real scenario. My requirement is that sometimes I will need to display the "n" form fields values in other forms. I need to know if I do this in Orbeon. And how? Because I am a newbie in Orbeon.

Thanks
Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Jez
Hi

I can tell you it is possible in Orbeon Forms to retrieve data from other form instances.

I can't tell you how, because there are a number of ways to do it, each tailored towards different scenarios.

IMHO, your question is too general; along the lines of "Can I use a database to capture information, and if so, how?".

Regards

Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Hank Ratzesberger-3
In reply to this post by RSS87
Hi,

Well, two forms on the same page, but good point.

Like other Java Servlet applications, you have server and session variables so that pages share data between them. You could have the instance stored in a session variable and your model xpl file could get the instance and include it in the xhtml (view) file.


So the "referring" is not automatic, but the server insures that you get and set variables in the same session.

--Hank

On Friday, October 18, 2013, RSS87 wrote:
Hi,


I think that your approach is for 2 fields of the same form. But I have two
forms, and I need to show the value of the field in the first form, to the
second form.

Somebody can help me please..

Thanks

--
View this message in context: http://discuss.orbeon.com/How-I-can-relate-different-forms-fields-tp4657489p4657500.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.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 <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orbeon+unsubscribe@googlegroups.com&#39;)">orbeon+unsubscribe@....
To post to this group, send email to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orbeon@googlegroups.com&#39;)">orbeon@....


--
Hank Ratzesberger
XMLWerks.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].
Jez
Reply | Threaded
Open this post in threaded view
|

Re: How I can relate different forms fields?

Jez
In reply to this post by RSS87
Maybe I can give you an overview.

Orbeon's presistence layer provides a REST API (link). This API allows you to Search, Create, Read, Update and Delete data stored within the persistence layer (Form Data and Form Definitions).

REST API Services can be called from within a Form using a Service and an Action (link). The Action can be used to populate data within the calling Form instance(s).

So, if you knew the Document ID of the first form you could Read it from the second form and populate a control with the return. If you wanted to search the first form for a particular record you could build a query and use the Search interface, the Search interface would also allow you to define the returning elements. The action would allow you to define how you wanted to use the data in the calling Form (drop-down, output, etc.).

If the data needs to persist in the second form, for data integrity purposes I would look at storing the ID of the referenced doc as the actual value and looking up labels at run-time.

Regards

Jez