<xforms:action> not always firing after value changed

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

<xforms:action> not always firing after value changed

Stephanie Hall (TT)

So on one of my pages I have a repeater, and each row in this repeater has one radio button.  The expected behavior is that each time I click a radio button, it should fire the xforms-value-changed event and run my Javascript function (we only want one of the radio buttons checked at any time across all the rows).  The problem is as follows:  Say I have 2 buttons.  Clicking on the first one will fire the action event, then clicking on the second radio button will fire the action event, but going back and clicking the first button again will NOT trigger the event. 

 

I know that description might’ve been a bit difficult to understand, so I’ve attached a .jsp file and a .js file to demonstrate. 

 

Steps to reproduce:

1.       Click the “Add New Output” button twice. 

2.       Click on the first radio button.  A “2” should appear in the “Index of…” input box

3.       Click on the second radio button.  The selected button on the first should disappear.  A “3” should appear in the “Index of…” input box

4.       Click on the first radio button again.   The selected button on the second will not move, and the Index Of.. box will not change even though both should’ve changed.

 

Is this a bug, or am I doing something wrong here?

 

Thanks!

Stephanie



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

example.js (762 bytes) Download Attachment
example.jsp (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: <xforms:action> not always firing after value changed

Alessandro  Vernet
Administrator
Stephanie,

On Fri, Nov 13, 2009 at 1:38 PM, Stephanie Hall (TT)
<[hidden email]> wrote:
> So on one of my pages I have a repeater, and each row in this repeater has
> one radio button.  The expected behavior is that each time I click a radio
> button, it should fire the xforms-value-changed event and run my Javascript
> function (we only want one of the radio buttons checked at any time across
> all the rows).  The problem is as follows:  Say I have 2 buttons.  Clicking
> on the first one will fire the action event, then clicking on the second
> radio button will fire the action event, but going back and clicking the
> first button again will NOT trigger the event.

I assume that you want to have in the mainModel instance the
true/false set depending on which radio button is selected, and that
you want to have in tempMainInstance the index of the radio that was
selected. Assuming that this is what you are looking for, I updated
your example (see attached). The result is best illustrated with a
screencast: http://screencast.com/t/M2M0ZDEw.

Without any JavaScript, the trick is to have the select1 store the
position of the currently selected radio in the tempMainInstance, and
to have the true/false values in mainModel driven by the index using a
calculate. I hope that the code will be clearer than my attempt as
explaining it! ;)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


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

example.jsp (3K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: Re: <xforms:action> not always firing after value changed

Stephanie Hall (TT)
That works like a charm!  Thanks, Alex!

BTW, was that screencast supposed to have sound?  Because it did not.

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Sunday, November 15, 2009 3:59 AM
To: [hidden email]
Subject: [ops-users] Re: <xforms:action> not always firing after value changed

Stephanie,

On Fri, Nov 13, 2009 at 1:38 PM, Stephanie Hall (TT) <[hidden email]> wrote:
> So on one of my pages I have a repeater, and each row in this repeater
> has one radio button.  The expected behavior is that each time I click
> a radio button, it should fire the xforms-value-changed event and run
> my Javascript function (we only want one of the radio buttons checked
> at any time across all the rows).  The problem is as follows:  Say I
> have 2 buttons.  Clicking on the first one will fire the action event,
> then clicking on the second radio button will fire the action event,
> but going back and clicking the first button again will NOT trigger the event.

I assume that you want to have in the mainModel instance the true/false set depending on which radio button is selected, and that you want to have in tempMainInstance the index of the radio that was selected. Assuming that this is what you are looking for, I updated your example (see attached). The result is best illustrated with a
screencast: http://screencast.com/t/M2M0ZDEw.

Without any JavaScript, the trick is to have the select1 store the position of the currently selected radio in the tempMainInstance, and to have the true/false values in mainModel driven by the index using a calculate. I hope that the code will be clearer than my attempt as explaining it! ;)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet


--
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: RE: Re: <xforms:action> not always firing after value changed

Alessandro  Vernet
Administrator
Stephanie,

On Mon, Nov 16, 2009 at 7:22 AM, Stephanie Hall (TT)
<[hidden email]> wrote:
> That works like a charm!  Thanks, Alex!

Excellent; I am glad to read that.

> BTW, was that screencast supposed to have sound?  Because it did not.

That's right, I didn't record any sound going with it.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

RE: RE: Re: <xforms:action> not always firing after value changed

Stephanie Hall (TT)
In reply to this post by Stephanie Hall (TT)
Resurrecting this thread because I have a question relating to it:

Now I am loading different sections of my instance based on which OS the user selects in a drop-down menu.  My group ref changes depending on this using something like instance('main')/config[os=instance('selectedOS')/ostype].  

So on default it loads windows 32, and I set the main for the win32 section (and I can see it in the log due to the debug output). Then if I switch it to the win64 section I can set that section's main. In both of these cases, the radio button shows up the way it should and the instance is populated as it should be.  But if I want to switch back to displaying the win32 section, the radio buttons are gone.  How can I get them to show up? It looks fine in the instance XML itself, but I am required to show it in the GUI also.  

I've attached an example to help illustrate.

Thanks!
Stephanie



-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Sunday, November 15, 2009 3:59 AM
To: [hidden email]
Subject: [ops-users] Re: <xforms:action> not always firing after value changed

Stephanie,

On Fri, Nov 13, 2009 at 1:38 PM, Stephanie Hall (TT) <[hidden email]> wrote:
> So on one of my pages I have a repeater, and each row in this repeater
> has one radio button.  The expected behavior is that each time I click
> a radio button, it should fire the xforms-value-changed event and run
> my Javascript function (we only want one of the radio buttons checked
> at any time across all the rows).  The problem is as follows:  Say I
> have 2 buttons.  Clicking on the first one will fire the action event,
> then clicking on the second radio button will fire the action event,
> but going back and clicking the first button again will NOT trigger the event.

I assume that you want to have in the mainModel instance the true/false set depending on which radio button is selected, and that you want to have in tempMainInstance the index of the radio that was selected. Assuming that this is what you are looking for, I updated your example (see attached). The result is best illustrated with a
screencast: http://screencast.com/t/M2M0ZDEw.

Without any JavaScript, the trick is to have the select1 store the position of the currently selected radio in the tempMainInstance, and to have the true/false values in mainModel driven by the index using a calculate. I hope that the code will be clearer than my attempt as explaining it! ;)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet


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

example.jsp (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: RE: RE: Re: <xforms:action> not always firing after value changed

Stephanie Hall (TT)
I should clarify that the radio buttons are not gone, rather my selected main does not display anymore.

-----Original Message-----
From: Stephanie Hall (TT) [mailto:[hidden email]]
Sent: Monday, December 07, 2009 2:06 PM
To: [hidden email]
Subject: [ops-users] RE: RE: Re: <xforms:action> not always firing after value changed

Resurrecting this thread because I have a question relating to it:

Now I am loading different sections of my instance based on which OS the user selects in a drop-down menu.  My group ref changes depending on this using something like instance('main')/config[os=instance('selectedOS')/ostype].  

So on default it loads windows 32, and I set the main for the win32 section (and I can see it in the log due to the debug output). Then if I switch it to the win64 section I can set that section's main. In both of these cases, the radio button shows up the way it should and the instance is populated as it should be.  But if I want to switch back to displaying the win32 section, the radio buttons are gone.  How can I get them to show up? It looks fine in the instance XML itself, but I am required to show it in the GUI also.  

I've attached an example to help illustrate.

Thanks!
Stephanie



-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Sunday, November 15, 2009 3:59 AM
To: [hidden email]
Subject: [ops-users] Re: <xforms:action> not always firing after value changed

Stephanie,

On Fri, Nov 13, 2009 at 1:38 PM, Stephanie Hall (TT) <[hidden email]> wrote:
> So on one of my pages I have a repeater, and each row in this repeater
> has one radio button.  The expected behavior is that each time I click
> a radio button, it should fire the xforms-value-changed event and run
> my Javascript function (we only want one of the radio buttons checked
> at any time across all the rows).  The problem is as follows:  Say I
> have 2 buttons.  Clicking on the first one will fire the action event,
> then clicking on the second radio button will fire the action event,
> but going back and clicking the first button again will NOT trigger the event.

I assume that you want to have in the mainModel instance the true/false set depending on which radio button is selected, and that you want to have in tempMainInstance the index of the radio that was selected. Assuming that this is what you are looking for, I updated your example (see attached). The result is best illustrated with a
screencast: http://screencast.com/t/M2M0ZDEw.

Without any JavaScript, the trick is to have the select1 store the position of the currently selected radio in the tempMainInstance, and to have the true/false values in mainModel driven by the index using a calculate. I hope that the code will be clearer than my attempt as explaining it! ;)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet


--
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: RE: RE: RE: Re: <xforms:action> not always firing after value changed

Erik Bruchez
Administrator
Stephanie,

I ran your example but I am not clear on what steps need to be done to
reproduce, and what the problem actually is ;)

-Erik

On Mon, Dec 7, 2009 at 2:26 PM, Stephanie Hall (TT)
<[hidden email]> wrote:

> I should clarify that the radio buttons are not gone, rather my selected main does not display anymore.
>
> -----Original Message-----
> From: Stephanie Hall (TT) [mailto:[hidden email]]
> Sent: Monday, December 07, 2009 2:06 PM
> To: [hidden email]
> Subject: [ops-users] RE: RE: Re: <xforms:action> not always firing after value changed
>
> Resurrecting this thread because I have a question relating to it:
>
> Now I am loading different sections of my instance based on which OS the user selects in a drop-down menu.  My group ref changes depending on this using something like instance('main')/config[os=instance('selectedOS')/ostype].
>
> So on default it loads windows 32, and I set the main for the win32 section (and I can see it in the log due to the debug output). Then if I switch it to the win64 section I can set that section's main. In both of these cases, the radio button shows up the way it should and the instance is populated as it should be.  But if I want to switch back to displaying the win32 section, the radio buttons are gone.  How can I get them to show up? It looks fine in the instance XML itself, but I am required to show it in the GUI also.
>
> I've attached an example to help illustrate.
>
> Thanks!
> Stephanie
>
>
>
> -----Original Message-----
> From: Alessandro Vernet [mailto:[hidden email]]
> Sent: Sunday, November 15, 2009 3:59 AM
> To: [hidden email]
> Subject: [ops-users] Re: <xforms:action> not always firing after value changed
>
> Stephanie,
>
> On Fri, Nov 13, 2009 at 1:38 PM, Stephanie Hall (TT) <[hidden email]> wrote:
>> So on one of my pages I have a repeater, and each row in this repeater
>> has one radio button.  The expected behavior is that each time I click
>> a radio button, it should fire the xforms-value-changed event and run
>> my Javascript function (we only want one of the radio buttons checked
>> at any time across all the rows).  The problem is as follows:  Say I
>> have 2 buttons.  Clicking on the first one will fire the action event,
>> then clicking on the second radio button will fire the action event,
>> but going back and clicking the first button again will NOT trigger the event.
>
> I assume that you want to have in the mainModel instance the true/false set depending on which radio button is selected, and that you want to have in tempMainInstance the index of the radio that was selected. Assuming that this is what you are looking for, I updated your example (see attached). The result is best illustrated with a
> screencast: http://screencast.com/t/M2M0ZDEw.
>
> Without any JavaScript, the trick is to have the select1 store the position of the currently selected radio in the tempMainInstance, and to have the true/false values in mainModel driven by the index using a calculate. I hope that the code will be clearer than my attempt as explaining it! ;)
>
> Alex
> --
> Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet
>
>
> --
> 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