Question and Answer link by order. Please help!

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

Question and Answer link by order. Please help!

richhl
Would u please take me a hand...i'm annoyed!!!!!

I would like to take tag text as enunciate from one instance and store the answer in another instance by means of and index relating questions an answers. Here is a simple test code that does not work.

<xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xhtml="http://www.w3.org/1999/xhtml">
    <xhtml:head>
        <xhtml:title>Question-Answer positional link test</xhtml:title>
        <xforms:model id="main-model">
            <xforms:instance id="answers" >
                <answers xmlns="">
                    <answer/>
                    <answer/>
                    <answer/>
                </answers>
            </xforms:instance>
            <xforms:instance id="questions">
                <questions xmlns="">
                    <question order="1">Pregunta 1</question>
                    <question order="2">Pregunta 2</question>
                    <question order="3">Pregunta 3</question>
                </questions>
            </xforms:instance>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xhtml:div class="maincontent">
        <xforms:repeat nodeset="instance('questions')/question">
            <xforms:input ref="instance('answers')/answer[xxforms:current-repeat/@order]">
                <xforms:label value="."/>
            </xforms:input>
        </xforms:repeat>
        </xhtml:div>

        <widget:xforms-instance-inspector
                        xmlns:widget="http://orbeon.org/oxf/xml/widget" />
    </xhtml:body>
</xhtml:html>

thax a lot for any clue!


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Question and Answer link by order. Please help!

StephR
Hi Richard,

I don't understand what you wish to do... could you explain again ?

<xforms:repeat nodeset="instance('questions')/question">
            <xforms:input ref="instance('answers')/answer[xxforms:current-repeat/@order]">
                <xforms:label value="."/>
            </xforms:input>
        </xforms:repeat>
Anyway, the value="." is in the context of instance('answers') ... so it's normal that nothing can be seen, because that instance is empty. Or i'm missing the idea...



Richard C. Hidalgo Lorite a écrit :
Would u please take me a hand...i'm annoyed!!!!!

I would like to take tag text as enunciate from one instance and store the answer in another instance by means of and index relating questions an answers. Here is a simple test code that does not work.

<xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xhtml="http://www.w3.org/1999/xhtml">
    <xhtml:head>
        <xhtml:title>Question-Answer positional link test</xhtml:title>
        <xforms:model id="main-model">
            <xforms:instance id="answers" >
                <answers xmlns="">
                    <answer/>
                    <answer/>
                    <answer/>
                </answers>
            </xforms:instance>
            <xforms:instance id="questions">
                <questions xmlns="">
                    <question order="1">Pregunta 1</question>
                    <question order="2">Pregunta 2</question>
                    <question order="3">Pregunta 3</question>
                </questions>
            </xforms:instance>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xhtml:div class="maincontent">
        <xforms:repeat nodeset="instance('questions')/question">
            <xforms:input ref="instance('answers')/answer[xxforms:current-repeat/@order]">
                <xforms:label value="."/>
            </xforms:input>
        </xforms:repeat>
        </xhtml:div>

        <widget:xforms-instance-inspector
                        xmlns:widget="http://orbeon.org/oxf/xml/widget" />
    </xhtml:body>
</xhtml:html>

thax a lot for any clue!
  


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Question and Answer link by order. Please help!

richhl
> Hi Richard,
>
> I don't understand what you wish to do... could you explain again ?

english is not my native language...let's give it a try..

I want the value at the ith node of my answers instance to be modified using the input control with the ith index generated from a repeat against my questions instance.

>
> <xforms:repeat nodeset="">
>             <xforms:input ref="instance('answers')/answer[xxforms:current-repeat/@order]">
>                 <xforms:label value="."/>
>             </xforms:input>
></xforms:repeat>

>Anyway, the value="." is in the context of instance('answers') ... so it's normal that nothing can be seen, because that instance is empty.

Yes, but you can put there a literal or instance('questions')/question and you get same result...nothing rendered.

thx in advance.

rich


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Question and Answer link by order. Please help!

richhl
In reply to this post by StephR
I've attached a better example in order to be run at xforms sandbox. xxforms:current-repeat/@order is not behaviouring as I expected. All select1's change the same answer node,...

could you give me some clue? is there any other easy way to do what I want?

thx

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

linked-instances-test.xhtml (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Question and Answer link by order. Solved!

richhl
I've got it. Attached like a code snippet for anyone that need it.

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

linked-instances-test.xhtml (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Question and Answer link by order. Solved!

StephR
Great!

Now, for the gurus or yourself, why can't we put the following :

  <xforms:select1 ref="instance('answers')/answer[position() = index('buclePreguntas')]">

or even

  <xforms:select1 ref="instance('answers')/answer[index('buclePreguntas')]">

Isn't there a way the go the current index (1, 2, 3 etc...) instead of using the attribute order ?



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Question and Answer link by order. Solved!

Erik Bruchez
Administrator
Steph,

> Now, for the gurus or yourself, why can't we put the following :
>
>   <xforms:select1 ref="instance('answers')/answer[position() =  
> index('buclePreguntas')]">
>
>   <xforms:select1 ref="instance('answers')/
> answer[index('buclePreguntas')]">
>
> Isn't there a way the go the current index (1, 2, 3 etc...) instead  
> of using the attribute order ?
For all the iterations of the repeat, the index() function will return  
the same value. That's because in XForms, a repeat "index" is the  
currently selected iteration of the repeat. In other words, index !=  
position.

If the user clicks on row 3 of a repeated table, the index's value is  
now 3. If the user clicks on row 1, it is 1.

This is why we introduced the xxforms:repeat-current() function, which  
*will* vary for each iteration of the repeat

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Multiple model conditional submission

mferry
Hello everyone,

I'm not sure that my message was correctly posted using Nabble so excuse me
if this is a duplicate. I repost it:

First of all, I wish you all a merry christmas (a little bit late) and a
happy new year to come.

Well I'm currently facing a tricky issue with Orbeon and I hope you will be
able to give me some advice.

My aim is to handle an order form. This order form is to be printed (as
PDF, the PDF template processor works amazingly) and sent as XML file to
another system.
The thing is that this form contains some private data that:
* should only be printed, and not be transferred (for example Credit Card
Number);
* should anyway be validated other XML schema.

The solution I found and that almost works now is:
* separate the data to be transmitted (public) and data to be only printed
(private) into two Xforms models;
* thus, the public model AND the private model can refer to their own XML
schema. This works fine and fields controls on screen are correct.
* on PDF submission, I use a print-instance in which I agregate public and
private instances to be printed.
* on file submission, I only submit the public instance.

All this is working very well.

BUT:
* Whereas the controls shows exclamation marks on private instance (in
private model) fields when not valid, I am able to submit the complete form
for PDF output.
I think this is due to the fact that the submission I use is declared in
the public model, and thus it does not try to validate the private
model...!

I have attached a very simple example exposing this behavior:
(See attached file: testxform.zip)

In this example, the user is able to download the public instance even if
the private one is not valid.

In fact my question is simple: how can I prevent the submission of an
instance if another instance, located in another model, is not valid?
Or maybe can you help me with another suggestion that does not involve
model separation.

Thank you for your support on this.

--
Mathieu FERRY


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

testxform.zip (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Multiple model conditional submission

David McIntyre
Hi Mathieu,

Rather than chaining the submissions as you are doing, with
  <xforms:submission id="download" ref="instance('myinstance')" method="post" action="/testxform/download" replace="all" xxforms:show-progress="false">
    <xforms:send ev:event="xforms-submit" model="private" submission="download-private"/>
    <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
  </xforms:submission>
maybe you should try sending the "download-private" submission, and only firing the "download" submission if and when that submission succeeds.

So you would use something like
  <xforms:submission id="download-private" ref="instance('private-instance')" method="post" action="/testxform/download-private" replace="all" xxforms:show-progress="false">
    <xforms:send ev:event="xforms-submit-done" submission="download"/>
    <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
  </xforms:submission>
and you would not give the users a trigger to submit "download" directly, only one to trigger "download-private".

Cheers,

    Dave Mc.

----- Original Message -----
From: "mathieu ferry" <[hidden email]>
To: [hidden email]
Sent: 27 December 2007 21:29:37 o'clock (GMT+1200) Auto-Detected
Subject: [ops-users] Multiple model conditional submission

Hello everyone,

I'm not sure that my message was correctly posted using Nabble so excuse me
if this is a duplicate. I repost it:

First of all, I wish you all a merry christmas (a little bit late) and a
happy new year to come.

Well I'm currently facing a tricky issue with Orbeon and I hope you will be
able to give me some advice.

My aim is to handle an order form. This order form is to be printed (as
PDF, the PDF template processor works amazingly) and sent as XML file to
another system.
The thing is that this form contains some private data that:
* should only be printed, and not be transferred (for example Credit Card
Number);
* should anyway be validated other XML schema.

The solution I found and that almost works now is:
* separate the data to be transmitted (public) and data to be only printed
(private) into two Xforms models;
* thus, the public model AND the private model can refer to their own XML
schema. This works fine and fields controls on screen are correct.
* on PDF submission, I use a print-instance in which I agregate public and
private instances to be printed.
* on file submission, I only submit the public instance.

All this is working very well.

BUT:
* Whereas the controls shows exclamation marks on private instance (in
private model) fields when not valid, I am able to submit the complete form
for PDF output.
I think this is due to the fact that the submission I use is declared in
the public model, and thus it does not try to validate the private
model...!

I have attached a very simple example exposing this behavior:
(See attached file: testxform.zip)

In this example, the user is able to download the public instance even if
the private one is not valid.

In fact my question is simple: how can I prevent the submission of an
instance if another instance, located in another model, is not valid?
Or maybe can you help me with another suggestion that does not involve
model separation.

Thank you for your support on this.

--
Mathieu FERRY



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Réf. : Re: Multiple model conditional submission

mferry
Thank you David for your answer,

First of all happy new year to everyone!

If I apply your suggestion, Orbeon validates correctly the private
instance, but:
* does not validate the public one;
* gives me the private instance in the downloaded file, not the public one.

Any further suggestions?

Best regards,
--
Mathieu FERRY
ABCnet: DCSI/DSIN/SIDM/ASFI
Poste 45 55 22
(+33)(0) 1 61 45 55 22
Contact: [hidden email]
ABCnet Teamroom



                                                                       
             David McIntyre                                            
             <david.mcintyre@                                          
             orionhealth.com>                                         Pour
                                       [hidden email]              
             02/01/2008 09:23                                           cc
             PM                                                        
                                                                     Objet
                                       Re: [ops-users] Multiple model  
                 Veuillez              conditional submission          
                répondre à                                        
             [hidden email]                                          
                    g                                                  
                                                                       
                                                                       
                                                                       




Hi Mathieu,

Rather than chaining the submissions as you are doing, with
  <xforms:submission id="download" ref="instance('myinstance')"
method="post" action="/testxform/download" replace="all"
xxforms:show-progress="false">
    <xforms:send ev:event="xforms-submit" model="private"
submission="download-private"/>
    <xforms:message ev:event="xforms-submit-error" level="modal">An error
occurred while saving!</xforms:message>
  </xforms:submission>
maybe you should try sending the "download-private" submission, and only
firing the "download" submission if and when that submission succeeds.

So you would use something like
  <xforms:submission id="download-private"
ref="instance('private-instance')" method="post"
action="/testxform/download-private" replace="all"
xxforms:show-progress="false">
    <xforms:send ev:event="xforms-submit-done" submission="download"/>
    <xforms:message ev:event="xforms-submit-error" level="modal">An error
occurred while saving!</xforms:message>
  </xforms:submission>
and you would not give the users a trigger to submit "download" directly,
only one to trigger "download-private".

Cheers,

    Dave Mc.

----- Original Message -----
From: "mathieu ferry" <[hidden email]>
To: [hidden email]
Sent: 27 December 2007 21:29:37 o'clock (GMT+1200) Auto-Detected
Subject: [ops-users] Multiple model conditional submission

Hello everyone,

I'm not sure that my message was correctly posted using Nabble so excuse me
if this is a duplicate. I repost it:

First of all, I wish you all a merry christmas (a little bit late) and a
happy new year to come.

Well I'm currently facing a tricky issue with Orbeon and I hope you will be
able to give me some advice.

My aim is to handle an order form. This order form is to be printed (as
PDF, the PDF template processor works amazingly) and sent as XML file to
another system.
The thing is that this form contains some private data that:
* should only be printed, and not be transferred (for example Credit Card
Number);
* should anyway be validated other XML schema.

The solution I found and that almost works now is:
* separate the data to be transmitted (public) and data to be only printed
(private) into two Xforms models;
* thus, the public model AND the private model can refer to their own XML
schema. This works fine and fields controls on screen are correct.
* on PDF submission, I use a print-instance in which I agregate public and
private instances to be printed.
* on file submission, I only submit the public instance.

All this is working very well.

BUT:
* Whereas the controls shows exclamation marks on private instance (in
private model) fields when not valid, I am able to submit the complete form
for PDF output.
I think this is due to the fact that the submission I use is declared in
the public model, and thus it does not try to validate the private
model...!

I have attached a very simple example exposing this behavior:
(See attached file: testxform.zip)

In this example, the user is able to download the public instance even if
the private one is not valid.

In fact my question is simple: how can I prevent the submission of an
instance if another instance, located in another model, is not valid?
Or maybe can you help me with another suggestion that does not involve
model separation.

Thank you for your support on this.

--
Mathieu FERRY


--
You receive this message as a subscriber of the [hidden email] mailing
list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws