Anyone have a better idea?

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

Anyone have a better idea?

Ryan Puddephatt

Hi all,

            I’m trying to improve the functionality of my Xforms pages, but I can’t seem to find a better solution! Most of my pages have the following functionality. I click submit my form, which runs an XPL and returns data. I have a <select><case> to show results if there are, but show nothing if my XPL doesn’t return anything!

 

When the submission comes back to the page the following action occurs

 

<xforms:action ev:event="xforms-submit-done">

 <xforms:setvalue ref="instance('tests')/foundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) gt 0) then instance('tests')/foundData + 1 else instance('tests')/foundData"/>

 <xforms:setvalue ref="instance('tests')/noFoundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) = 0) then instance('tests')/noFoundData + 1 else instance('tests')/noFoundData"/>

</xforms:action>

 

When these values are changed it cases this

 

<xforms:input ref="foundData">

 <xforms:label class="fixed-width">test foundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed">

  <xforms:toggle case="foundData"/>           

 </xforms:action>

</xforms:input>

<xforms:input ref="noFoundData">

 <xforms:label class="fixed-width">test noFoundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed" >

  <xforms:toggle case="noFoundData"/>               

 </xforms:action>

</xforms:input>

 

Which in turn toggles the <select><case> to the appropriate one. I am finding that on some of my pages I’m getting a bottleneck on performance with the above. Has anyone got a better way to toggle the <case> when checking data?

 

Thanks

 

Ryan Puddephatt

Web Developer

TFX Group

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 

 



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Anyone have a better idea?

Stephen Bayliss

Something like…

 

xforms:bind, binding to your foundPEAs node; with a “relevant” attribute with an xpath expression to test if there are any child nodes.

 

Then an xforms:group surrounding the controls you want to show/hide, also referencing the foundPEAs node; but without controls changing instance data, instead the xpath in the “relevant” attribute can determine directly whether there was data.

 

Basically it’s similar to the technique that Erik proposed in the note below:

 

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: 15 November 2005 14:21
To: [hidden email]
Subject: Re: [ops-users] Re: 1. xforms:input + xforms:hint 2. dynamic input?

 

[hidden email] wrote:

 

 > Is there a way for binding xforms:case to xforms:select1 or direct

 > to a value of xforms instance?

 

I think I understand better what you are trying to achieve. This is

what I suggest you do:

 

1. Use xforms:select1 to choose between one of two possible values

 

    <xforms:instance id="main">

      <control xmlns="">

        <my-select-value>1</my-select-value>

      </control>

    </xforms:instance>

 

    <xforms:select1 ref="instance('main')/my-select-value">

      <xforms:item>

        <xforms:name>First</xforms:name>

        <xforms:value>1</xforms:value>

      </xforms:item>

      <xforms:item>

        <xforms:name>Second</xforms:name>

        <xforms:value>2</xforms:value>

      </xforms:item>

    </xforms:select1

 

2. Use an extra XForms instance and xforms:bind to determine some

    relevant nodes:

 

    <xforms:instance id="control-instance">

      <control xmlns="">

        <show-controls-1/>

        <show-controls-2/>

      </control>

    </xforms:instance>

 

    <xforms:bind nodeset="instance('control-instance')/show-controls-1"

relevant="instance('main')/my-select-value = 1"/>

    <xforms:bind nodeset="instance('control-instance')/show-controls-2"

relevant="instance('main')/my-select-value = 2"/>

 

    <xforms:group ref="instance('control-instance')/show-controls-1">

      ... this group will be visible when you select the value "1" ...

    </xforms:group

 

    <xforms:group ref="instance('control-instance')/show-controls-2">

      ... this group will be visible when you select the value "2" ...

    </xforms:group

 

I hope this helps,

 

-Erik

 

 

 

 


From: Ryan Puddephatt [mailto:[hidden email]]
Sent: 23 November 2005 17:07
To: [hidden email]
Subject: [ops-users] Anyone have a better idea?

 

Hi all,

            I’m trying to improve the functionality of my Xforms pages, but I can’t seem to find a better solution! Most of my pages have the following functionality. I click submit my form, which runs an XPL and returns data. I have a <select><case> to show results if there are, but show nothing if my XPL doesn’t return anything!

 

When the submission comes back to the page the following action occurs

 

<xforms:action ev:event="xforms-submit-done">

 <xforms:setvalue ref="instance('tests')/foundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) gt 0) then instance('tests')/foundData + 1 else instance('tests')/foundData"/>

 <xforms:setvalue ref="instance('tests')/noFoundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) = 0) then instance('tests')/noFoundData + 1 else instance('tests')/noFoundData"/>

</xforms:action>

 

When these values are changed it cases this

 

<xforms:input ref="foundData">

 <xforms:label class="fixed-width">test foundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed">

  <xforms:toggle case="foundData"/>           

 </xforms:action>

</xforms:input>

<xforms:input ref="noFoundData">

 <xforms:label class="fixed-width">test noFoundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed" >

  <xforms:toggle case="noFoundData"/>               

 </xforms:action>

</xforms:input>

 

Which in turn toggles the <select><case> to the appropriate one. I am finding that on some of my pages I’m getting a bottleneck on performance with the above. Has anyone got a better way to toggle the <case> when checking data?

 

Thanks

 

Ryan Puddephatt

Web Developer

TFX Group

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 

 



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Anyone have a better idea?

Ryan Puddephatt

That’s excellent, Thanks Stephen, that should remove my performance bottle neck!

 

Ryan Puddephatt

Web Developer

TFX Group

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 


From: Stephen Bayliss [mailto:[hidden email]]
Sent: 24 November 2005 08:25
To: [hidden email]
Subject: RE: [ops-users] Anyone have a better idea?

 

Something like…

 

xforms:bind, binding to your foundPEAs node; with a “relevant” attribute with an xpath expression to test if there are any child nodes.

 

Then an xforms:group surrounding the controls you want to show/hide, also referencing the foundPEAs node; but without controls changing instance data, instead the xpath in the “relevant” attribute can determine directly whether there was data.

 

Basically it’s similar to the technique that Erik proposed in the note below:

 

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: 15 November 2005 14:21
To: [hidden email]
Subject: Re: [ops-users] Re: 1. xforms:input + xforms:hint 2. dynamic input?

 

[hidden email] wrote:

 

 > Is there a way for binding xforms:case to xforms:select1 or direct

 > to a value of xforms instance?

 

I think I understand better what you are trying to achieve. This is

what I suggest you do:

 

1. Use xforms:select1 to choose between one of two possible values

 

    <xforms:instance id="main">

      <control xmlns="">

        <my-select-value>1</my-select-value>

      </control>

    </xforms:instance>

 

    <xforms:select1 ref="instance('main')/my-select-value">

      <xforms:item>

        <xforms:name>First</xforms:name>

        <xforms:value>1</xforms:value>

      </xforms:item>

      <xforms:item>

        <xforms:name>Second</xforms:name>

        <xforms:value>2</xforms:value>

      </xforms:item>

    </xforms:select1

 

2. Use an extra XForms instance and xforms:bind to determine some

    relevant nodes:

 

    <xforms:instance id="control-instance">

      <control xmlns="">

        <show-controls-1/>

        <show-controls-2/>

      </control>

    </xforms:instance>

 

    <xforms:bind nodeset="instance('control-instance')/show-controls-1"

relevant="instance('main')/my-select-value = 1"/>

    <xforms:bind nodeset="instance('control-instance')/show-controls-2"

relevant="instance('main')/my-select-value = 2"/>

 

    <xforms:group ref="instance('control-instance')/show-controls-1">

      ... this group will be visible when you select the value "1" ...

    </xforms:group

 

    <xforms:group ref="instance('control-instance')/show-controls-2">

      ... this group will be visible when you select the value "2" ...

    </xforms:group

 

I hope this helps,

 

-Erik

 

 

 

 


From: Ryan Puddephatt [mailto:[hidden email]]
Sent: 23 November 2005 17:07
To: [hidden email]
Subject: [ops-users] Anyone have a better idea?

 

Hi all,

            I’m trying to improve the functionality of my Xforms pages, but I can’t seem to find a better solution! Most of my pages have the following functionality. I click submit my form, which runs an XPL and returns data. I have a <select><case> to show results if there are, but show nothing if my XPL doesn’t return anything!

 

When the submission comes back to the page the following action occurs

 

<xforms:action ev:event="xforms-submit-done">

 <xforms:setvalue ref="instance('tests')/foundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) gt 0) then instance('tests')/foundData + 1 else instance('tests')/foundData"/>

 <xforms:setvalue ref="instance('tests')/noFoundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) = 0) then instance('tests')/noFoundData + 1 else instance('tests')/noFoundData"/>

</xforms:action>

 

When these values are changed it cases this

 

<xforms:input ref="foundData">

 <xforms:label class="fixed-width">test foundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed">

  <xforms:toggle case="foundData"/>           

 </xforms:action>

</xforms:input>

<xforms:input ref="noFoundData">

 <xforms:label class="fixed-width">test noFoundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed" >

  <xforms:toggle case="noFoundData"/>               

 </xforms:action>

</xforms:input>

 

Which in turn toggles the <select><case> to the appropriate one. I am finding that on some of my pages I’m getting a bottleneck on performance with the above. Has anyone got a better way to toggle the <case> when checking data?

 

Thanks

 

Ryan Puddephatt

Web Developer

TFX Group

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 

 



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Anyone have a better idea?

Ryan Puddephatt
In reply to this post by Stephen Bayliss

Hi all.

            I’ve used the bind/group technique and its working brilliantly, but I don’t understand why the switch/case is so much slower? Is it because of the event handling? Or calls being made to OPS which are done client side with bind/group? I thought both methods just used JS/CSS to show/hide the particular controls, or am I wrong in thinking this?

 

Just some idea of the difference would be great?

 

Ryan Puddephatt

Web Developer

TFX Group

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 


From: Stephen Bayliss [mailto:[hidden email]]
Sent: 24 November 2005 08:25
To: [hidden email]
Subject: RE: [ops-users] Anyone have a better idea?

 

Something like…

 

xforms:bind, binding to your foundPEAs node; with a “relevant” attribute with an xpath expression to test if there are any child nodes.

 

Then an xforms:group surrounding the controls you want to show/hide, also referencing the foundPEAs node; but without controls changing instance data, instead the xpath in the “relevant” attribute can determine directly whether there was data.

 

Basically it’s similar to the technique that Erik proposed in the note below:

 

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: 15 November 2005 14:21
To: [hidden email]
Subject: Re: [ops-users] Re: 1. xforms:input + xforms:hint 2. dynamic input?

 

[hidden email] wrote:

 

 > Is there a way for binding xforms:case to xforms:select1 or direct

 > to a value of xforms instance?

 

I think I understand better what you are trying to achieve. This is

what I suggest you do:

 

1. Use xforms:select1 to choose between one of two possible values

 

    <xforms:instance id="main">

      <control xmlns="">

        <my-select-value>1</my-select-value>

      </control>

    </xforms:instance>

 

    <xforms:select1 ref="instance('main')/my-select-value">

      <xforms:item>

        <xforms:name>First</xforms:name>

        <xforms:value>1</xforms:value>

      </xforms:item>

      <xforms:item>

        <xforms:name>Second</xforms:name>

        <xforms:value>2</xforms:value>

      </xforms:item>

    </xforms:select1

 

2. Use an extra XForms instance and xforms:bind to determine some

    relevant nodes:

 

    <xforms:instance id="control-instance">

      <control xmlns="">

        <show-controls-1/>

        <show-controls-2/>

      </control>

    </xforms:instance>

 

    <xforms:bind nodeset="instance('control-instance')/show-controls-1"

relevant="instance('main')/my-select-value = 1"/>

    <xforms:bind nodeset="instance('control-instance')/show-controls-2"

relevant="instance('main')/my-select-value = 2"/>

 

    <xforms:group ref="instance('control-instance')/show-controls-1">

      ... this group will be visible when you select the value "1" ...

    </xforms:group

 

    <xforms:group ref="instance('control-instance')/show-controls-2">

      ... this group will be visible when you select the value "2" ...

    </xforms:group

 

I hope this helps,

 

-Erik

 

 

 

 


From: Ryan Puddephatt [mailto:[hidden email]]
Sent: 23 November 2005 17:07
To: [hidden email]
Subject: [ops-users] Anyone have a better idea?

 

Hi all,

            I’m trying to improve the functionality of my Xforms pages, but I can’t seem to find a better solution! Most of my pages have the following functionality. I click submit my form, which runs an XPL and returns data. I have a <select><case> to show results if there are, but show nothing if my XPL doesn’t return anything!

 

When the submission comes back to the page the following action occurs

 

<xforms:action ev:event="xforms-submit-done">

 <xforms:setvalue ref="instance('tests')/foundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) gt 0) then instance('tests')/foundData + 1 else instance('tests')/foundData"/>

 <xforms:setvalue ref="instance('tests')/noFoundData" ev:event="xforms-submit-done" value="if (count(instance('foundPEAs')/pea-details) = 0) then instance('tests')/noFoundData + 1 else instance('tests')/noFoundData"/>

</xforms:action>

 

When these values are changed it cases this

 

<xforms:input ref="foundData">

 <xforms:label class="fixed-width">test foundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed">

  <xforms:toggle case="foundData"/>           

 </xforms:action>

</xforms:input>

<xforms:input ref="noFoundData">

 <xforms:label class="fixed-width">test noFoundData:</xforms:label>

 <xforms:action ev:event="xforms-value-changed" >

  <xforms:toggle case="noFoundData"/>               

 </xforms:action>

</xforms:input>

 

Which in turn toggles the <select><case> to the appropriate one. I am finding that on some of my pages I’m getting a bottleneck on performance with the above. Has anyone got a better way to toggle the <case> when checking data?

 

Thanks

 

Ryan Puddephatt

Web Developer

TFX Group

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 

 



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Anyone have a better idea?

Erik Bruchez
Administrator
I don't think there should be, in theory, a significant difference in
performance between the two. If there is one though, that would be
something to look at. As always, something reproducible would help!

-Erik

Ryan Puddephatt wrote:

> Hi all.
>
>             I?ve used the bind/group technique and its working
> brilliantly, but I don?t understand why the switch/case is so much
> slower? Is it because of the event handling? Or calls being made to OPS
> which are done client side with bind/group? I thought both methods just
> used JS/CSS to show/hide the particular controls, or am I wrong in
> thinking this?
>
>  
>
> Just some idea of the difference would be great?
>
>  
>
> *Ryan Puddephatt*
>
> Web Developer
>
> TFX Group
>
> 1 Michaelson Square
>
> Livingston
>
> West Lothian
>
> Scotand
>
> EH54 7DP
>
>  
>
> * [hidden email]
>
> ( 01506 407 110
>
> 7  01506 407 108


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws