Submission + repeated index

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

Submission + repeated index

StephR
Hi all,

This is really change and I hope I'm pointing in the right direction. To start, here is a part of my page-flow :

<page id="projectsSummary" path-info="/projectsSummary/projects" model="projectsList-model.xpl" view="projectsList-view.xhtml" />
 
<page id="updateInstance" path-info="/projectsSummary/updateInstance" model="updateInstance.xpl">
  <action>
      <result id="instance-updated" page="news" />
   <action>
 </page>

So first I show the list of all the projects (projectsList-view.xhtml). In a table, a repeat node will show on every line a project, and at the end of the line, i have a trigger :

<xforms:trigger ...>
    <xforms:action ev:event="DOMActivate">
        <xforms:send submission="main-submission"/>
    </xforms:action>
</xforms:trigger>

The submission that is called is the following :

<xforms:submission id="main-submission" ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]" method="post" action="/projectsSummary/updateInstance "/>

The idea is that I want to send the only project the user selected from projectSummary-instance to updateInstance. Is this right ?

Then to debug, in updateInstance I show data that is in the input parameter (by adding a view and putting the actions elements in comment). This WORKS everytime I put <action>...</action> in the page-flow above in comment! Because if I remove this comment, than another page "news" is called. Now the strange part, is that in that page, I always have the same project selected! This is really strange.. so my first question : is it right what I'm doing to select the correct project (i screw up always position, index, current-index, etc...)

Thanks



--
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: Submission + repeated index

StephR
This is interesting :

It seems that
instance('projectSummary-instance')/Project[index('document-info-repeat')] is correct.

Here is my theory :/ :
 
Before, in page-flow.xml, I was doing the following :

<page id="updateInstance" path-info="/projectsSummary/updateInstance" model="updateInstance.xpl">
    <action>
        <result id="instance-updated" page="news" />
    </action>
</page>

When arriving on the page "news", my data was partially missing, has if my "instance" was never updated! What I did is I put in comment the action element here above, and in updateInstance.xpl I added a redirect processor to my page "news" and everything is working as desired! Now, could it be that the action element is "too fast" and is loading before updateInstance was able to finish ? Whatever the answer is, I really don't like to use redirect processor, isn't there a way to do this differently from the page-flow ?



Stephane Ruchet a écrit :
Hi all,

This is really change and I hope I'm pointing in the right direction. To start, here is a part of my page-flow :

<page id="projectsSummary" path-info="/projectsSummary/projects" model="projectsList-model.xpl" view="projectsList-view.xhtml" />
 
<page id="updateInstance" path-info="/projectsSummary/updateInstance" model="updateInstance.xpl">
  <action>
      <result id="instance-updated" page="news" />
   <action>
 </page>

So first I show the list of all the projects (projectsList-view.xhtml). In a table, a repeat node will show on every line a project, and at the end of the line, i have a trigger :

<xforms:trigger ...>
    <xforms:action ev:event="DOMActivate">
        <xforms:send submission="main-submission"/>
    </xforms:action>
</xforms:trigger>

The submission that is called is the following :

<xforms:submission id="main-submission" ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]" method="post" action="/projectsSummary/updateInstance "/>

The idea is that I want to send the only project the user selected from projectSummary-instance to updateInstance. Is this right ?

Then to debug, in updateInstance I show data that is in the input parameter (by adding a view and putting the actions elements in comment). This WORKS everytime I put <action>...</action> in the page-flow above in comment! Because if I remove this comment, than another page "news" is called. Now the strange part, is that in that page, I always have the same project selected! This is really strange.. so my first question : is it right what I'm doing to select the correct project (i screw up always position, index, current-index, etc...)

Thanks



--
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: Submission + repeated index

StephR
In reply to this post by StephR
Attached you will find my implementation of what I'm trying to do.

I was expecting this bug : when one modifies the order of the projects with the exf:sort function, this works, but then when one selects it and launch this submission :

<xforms:submission id="main-submission" ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]" method="post" action="/projectsSummary/updateInstance "/>

The ref attribute will not point to the proper project because the sort function modified the user view of the list of project... so index(' .. ') will not return the proper index. How can I solved this ?

A possible solution would be to have another blank instance and when one hits a project, it will copy only the information of the selected project in this instance.. and than my main submission would ref only that instance so I wouldn't need anymore the index. Isn't there a nicer solution ?

Thanks


Stephane Ruchet a écrit :
Hi all,

This is really change and I hope I'm pointing in the right direction. To start, here is a part of my page-flow :

<page id="projectsSummary" path-info="/projectsSummary/projects" model="projectsList-model.xpl" view="projectsList-view.xhtml" />
 
<page id="updateInstance" path-info="/projectsSummary/updateInstance" model="updateInstance.xpl">
  <action>
      <result id="instance-updated" page="news" />
   <action>
 </page>

So first I show the list of all the projects (projectsList-view.xhtml). In a table, a repeat node will show on every line a project, and at the end of the line, i have a trigger :

<xforms:trigger ...>
    <xforms:action ev:event="DOMActivate">
        <xforms:send submission="main-submission"/>
    </xforms:action>
</xforms:trigger>

The submission that is called is the following :

<xforms:submission id="main-submission" ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]" method="post" action="/projectsSummary/updateInstance "/>

The idea is that I want to send the only project the user selected from projectSummary-instance to updateInstance. Is this right ?

Then to debug, in updateInstance I show data that is in the input parameter (by adding a view and putting the actions elements in comment). This WORKS everytime I put <action>...</action> in the page-flow above in comment! Because if I remove this comment, than another page "news" is called. Now the strange part, is that in that page, I always have the same project selected! This is really strange.. so my first question : is it right what I'm doing to select the correct project (i screw up always position, index, current-index, etc...)

Thanks



--
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

projectsList-view.xhtml (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Submission + repeated index

StephR
Well my solution will not working either. As soon one as sorted differently the list, I will not copy the right project. What can I do ? A refresh? I really don't want to use XSL but I might have to :(



Stephane Ruchet a écrit :
Attached you will find my implementation of what I'm trying to do.

I was expecting this bug : when one modifies the order of the projects with the exf:sort function, this works, but then when one selects it and launch this submission :

<xforms:submission id="main-submission" ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]" method="post" action="/projectsSummary/updateInstance "/>

The ref attribute will not point to the proper project because the sort function modified the user view of the list of project... so index(' .. ') will not return the proper index. How can I solved this ?

A possible solution would be to have another blank instance and when one hits a project, it will copy only the information of the selected project in this instance.. and than my main submission would ref only that instance so I wouldn't need anymore the index. Isn't there a nicer solution ?

Thanks


Stephane Ruchet a écrit :
Hi all,

This is really change and I hope I'm pointing in the right direction. To start, here is a part of my page-flow :

<page id="projectsSummary" path-info="/projectsSummary/projects" model="projectsList-model.xpl" view="projectsList-view.xhtml" />
 
<page id="updateInstance" path-info="/projectsSummary/updateInstance" model="updateInstance.xpl">
  <action>
      <result id="instance-updated" page="news" />
   <action>
 </page>

So first I show the list of all the projects (projectsList-view.xhtml). In a table, a repeat node will show on every line a project, and at the end of the line, i have a trigger :

<xforms:trigger ...>
    <xforms:action ev:event="DOMActivate">
        <xforms:send submission="main-submission"/>
    </xforms:action>
</xforms:trigger>

The submission that is called is the following :

<xforms:submission id="main-submission" ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]" method="post" action="/projectsSummary/updateInstance "/>

The idea is that I want to send the only project the user selected from projectSummary-instance to updateInstance. Is this right ?

Then to debug, in updateInstance I show data that is in the input parameter (by adding a view and putting the actions elements in comment). This WORKS everytime I put <action>...</action> in the page-flow above in comment! Because if I remove this comment, than another page "news" is called. Now the strange part, is that in that page, I always have the same project selected! This is really strange.. so my first question : is it right what I'm doing to select the correct project (i screw up always position, index, current-index, etc...)

Thanks



--
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: Submission + repeated index

Alessandro Vernet
Administrator
In reply to this post by StephR
Stephane,

On Jan 19, 2008 11:55 AM, Stephane Ruchet <[hidden email]> wrote:
>  <page id="updateInstance" path-info="/projectsSummary/updateInstance"
> model="updateInstance.xpl">
>      <action>
>          <result id="instance-updated" page="news" />
>      </action>
>  </page>
>
>  When arriving on the page "news", my data was partially missing, has if my
> "instance" was never updated!

The model runs after the redirect. Another way to say it is that the
model only runs of the there is not redirect. Hence your
updateInstance.xpl not running. You can do this with an action instead
of a model. An action can return an a new document, and you can use
that document to send it to another page (using a doc('input:action')
inside <result> in XSLT). You can read more about this on
http://www.orbeon.com/ops/doc/reference-page-flow#action-element.

But instead of using the PFC for this, I would use XForms. In XForms
you can easily call a service that runs updateInstance.xpl, returns
the updated instance, and then post with xforms:submission that
updated instance to the other page (news).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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
|

Re: Submission + repeated index

Alessandro Vernet
Administrator
In reply to this post by StephR
On Jan 20, 2008 4:56 AM, Stephane Ruchet <[hidden email]> wrote:
> <xforms:submission id="main-submission"
> ref="instance('projectSummary-instance')/Project[index('document-info-repeat')]"
> method="post" action="/projectsSummary/updateInstance "/>
>
>  The ref attribute will not point to the proper project because the sort
> function modified the user view of the list of project... so index(' .. ')
> will not return the proper index. How can I solved this ?

Inside the trigger that you use to select the project, use a
<xforms:setvalue ref="instance('tmp')/project-id"
value="count(preceding-sibling::Project) + 1"/> (here assuming you
have a tmp instance you can use for this type of things). Then in the
submission use instance('tmp')/project-id instead of
index('document-info-repeat'). Does this make sense?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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