Problem with xforms-invalid events and non-relevant controls

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

Problem with xforms-invalid events and non-relevant controls

Mauno
Hi,
I've made "send form" button that becomes enabled when there is no invalid-controls in forms. Problem is that some fields seem to fire xforms-invalid although they are non-relevant.

I know XForms specs doesn't clearly say whether xforms-invalid should fire on non-relevant nodes.

Example I've this action=
<xforms:action ev:event="xforms-invalid" if="normalize-space(event('alert')) != ''">

Is there a way to test target elements relevancy like if="normalize-space(event('alert')) != '' and oxforms:isRelevant(event('target'))"?
Reply | Threaded
Open this post in threaded view
|

Re: Problem with xforms-invalid events and non-relevant controls

Erik Bruchez
Administrator
You could try:

   exforms:relevant(event('target-ref'))

Note that the "target-ref" attribute is an Orbeon Forms extension, and  
the exforms:relevant() function is defined here:

   http://www.exforms.org/mips.html

-Erik

On Mar 20, 2008, at 7:27 AM, Mauno wrote:

>
> Hi,
> I've made "send form" button that becomes enabled when there is no
> invalid-controls in forms. Problem is that some fields seem to fire
> xforms-invalid although they are non-relevant.
>
> I know XForms specs doesn't clearly say whether xforms-invalid  
> should fire
> on non-relevant nodes.
>
> Example I've this action=
> <xforms:action ev:event="xforms-invalid" if="normalize-
> space(event('alert'))
> != ''">
>
> Is there a way to test target elements relevancy like
> if="normalize-space(event('alert')) != '' and
> oxforms:isRelevant(event('target'))"?
--
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
|

Re: Problem with xforms-invalid events and non-relevant controls

Mauno
Thanks it works but now I have another issue:

If few controls become relevant they are moved to "errors-instance" like in xforms-sandbox/samples/error-summary.xhtml -sample. Now if users action causes them to become non-relevant again, their errors remain in errors-instance therefore user cannot send form.

Any suggestions how and when I should I iterate errors-instance's elements for non-relevant errors?

Erik Bruchez wrote
You could try:

   exforms:relevant(event('target-ref'))

Note that the "target-ref" attribute is an Orbeon Forms extension, and  
the exforms:relevant() function is defined here:

   http://www.exforms.org/mips.html

-Erik

On Mar 20, 2008, at 7:27 AM, Mauno wrote:

>
> Hi,
> I've made "send form" button that becomes enabled when there is no
> invalid-controls in forms. Problem is that some fields seem to fire
> xforms-invalid although they are non-relevant.
>
> I know XForms specs doesn't clearly say whether xforms-invalid  
> should fire
> on non-relevant nodes.
>
> Example I've this action=
> <xforms:action ev:event="xforms-invalid" if="normalize-
> space(event('alert'))
> != ''">
>
> Is there a way to test target elements relevancy like
> if="normalize-space(event('alert')) != '' and
> oxforms:isRelevant(event('target'))"?

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



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

Re: Re: Problem with xforms-invalid events and non-relevant controls

Alessandro Vernet
Administrator
On Mar 25, 2008, at 1:02 AM, Mauno wrote:

>
> Thanks it works but now I have another issue:
>
> If few controls become relevant they are moved to "errors-instance"  
> like in
> xforms-sandbox/samples/error-summary.xhtml -sample. Now if users  
> action
> causes them to become non-relevant again, their errors remain in
> errors-instance therefore user cannot send form.
>
> Any suggestions how and when I should I iterate errors-instance's  
> elements
> for non-relevant errors?

Could you maybe modify error-summary.xhtml to show what you are  
talking about, and we can take it from there, updating your modified  
version to do what you have in mind?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.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: Re: Problem with xforms-invalid events and non-relevant controls

Mauno

Alessandro Vernet wrote
Could you maybe modify error-summary.xhtml to show what you are  
talking about, and we can take it from there, updating your modified  
version to do what you have in mind?
Here you go. After form has loaded select "yep" from "Do you have a partner"-select. It will cause "partners age" control to become non-relevant.  After "partners age" disappears, it's error still remains in errors-instace.xforms-test.zip
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Problem with xforms-invalid events and non-relevant controls

Alessandro Vernet
Administrator
On Mar 26, 2008, at 1:34 AM, Mauno wrote:
> Here you go. After form has loaded select "yep" from "Do you have a
> partner"-select. It will cause "partners age" control to become
> non-relevant.  After "partners age" disappears, it's error still  
> remains in
> errors-instace. http://www.nabble.com/file/p16297674/xforms-test.zip
> xforms-test.zip

I did this in the attached file, which is an update on your  
view.xhtml. This involves storing the path to the node when we get the  
xforms-invalid event in the errors instance, and then checking that  
this node is relevant when we show errors in the table.

This code uses the saxon:path() and saxon:evaluate(), which are always  
"kind of hack", and which is also won't necessarily get you the best  
performance. I think it would be better to try to react to the xforms-
disabled and xforms-enabled event, and update a flag on the error  
element to say if the corresponding element is relevant or not. You  
might want to try try to do this instead of what I did.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.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

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

Re: Re: Re: Problem with xforms-invalid events and non-relevant controls

Mauno
Thanks  Alex!
I'll use xforms-disabled/enabed way, it sounds best. That way I can easily make send-button disabled if errors instance contains errors whose relative-flag is true.


Alessandro Vernet wrote
On Mar 26, 2008, at 1:34 AM, Mauno wrote:
> Here you go. After form has loaded select "yep" from "Do you have a
> partner"-select. It will cause "partners age" control to become
> non-relevant.  After "partners age" disappears, it's error still  
> remains in
> errors-instace. http://www.nabble.com/file/p16297674/xforms-test.zip
> xforms-test.zip

I did this in the attached file, which is an update on your  
view.xhtml. This involves storing the path to the node when we get the  
xforms-invalid event in the errors instance, and then checking that  
this node is relevant when we show errors in the table.

This code uses the saxon:path() and saxon:evaluate(), which are always  
"kind of hack", and which is also won't necessarily get you the best  
performance. I think it would be better to try to react to the xforms-
disabled and xforms-enabled event, and update a flag on the error  
element to say if the corresponding element is relevant or not. You  
might want to try try to do this instead of what I did.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/

 

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


-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Problem with xforms-invalid events and non-relevant controls

Mauno
I implemented xforms-disabled/enabled way and it works perfectly but only with Firefox 2.

With ie6/ie7 user gets client-side exception.
Exception in client-side code.
Message: Object required

I've narrowed this issue to table where errors are iterated=

    <xforms:repeat nodeset="instance('errors-instance')/error" id="errors-repeat">
  <xforms:group ref=".[@isRelevant = 'true']">
            </xforms:group>
  </xforms:repeat>
 
    <xforms:output value="if (string-length(@indexes) > 0) then concat('#', @indexes) else ''" />
 
  <xforms:output value="@alert" mediatype="text/html" />
 

If I remove <xforms:group ref=".[@isRelevant = 'true']"> it works. There seems to be another bug, that xforms:repeat repeats some nodes twice altough they are only once in the instance if I look errors-instance with inspector.



Mauno wrote
Thanks  Alex!
I'll use xforms-disabled/enabed way, it sounds best. That way I can easily make send-button disabled if errors instance contains errors whose relative-flag is true.


Alessandro Vernet wrote
On Mar 26, 2008, at 1:34 AM, Mauno wrote:
> Here you go. After form has loaded select "yep" from "Do you have a
> partner"-select. It will cause "partners age" control to become
> non-relevant.  After "partners age" disappears, it's error still  
> remains in
> errors-instace. http://www.nabble.com/file/p16297674/xforms-test.zip
> xforms-test.zip

I did this in the attached file, which is an update on your  
view.xhtml. This involves storing the path to the node when we get the  
xforms-invalid event in the errors instance, and then checking that  
this node is relevant when we show errors in the table.

This code uses the saxon:path() and saxon:evaluate(), which are always  
"kind of hack", and which is also won't necessarily get you the best  
performance. I think it would be better to try to react to the xforms-
disabled and xforms-enabled event, and update a flag on the error  
element to say if the corresponding element is relevant or not. You  
might want to try try to do this instead of what I did.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/

 

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


-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Problem with xforms-invalid events and non-relevant controls

Mauno
I got It working with ie7 with this hack. I made 2 tables, one that loops everything but that is hidden from user and one that is visible to user:


 
  <xforms:repeat nodeset="instance('errors-instance')/error" id="errors-repeat">
 
           
  </xforms:repeat>
   
                                            <xforms:repeat nodeset="instance('errors-instance')/error[@isRelevant = 'true']" id="errors-repeat2">
                                                                                                                                                        </xforms:repeat>     
 
                                                                                          <xforms:output value="if (string-length(@indexes) > 0) then concat('#', @indexes) else ''"/>
                           
                                <xforms:output value="@alert" mediatype="text/html"/>
                           
 


Mauno wrote
I implemented xforms-disabled/enabled way and it works perfectly but only with Firefox 2.

With ie6/ie7 user gets client-side exception.
Exception in client-side code.
Message: Object required

I've narrowed this issue to table where errors are iterated=

    <xforms:repeat nodeset="instance('errors-instance')/error" id="errors-repeat">
  <xforms:group ref=".[@isRelevant = 'true']">
            </xforms:group>
  </xforms:repeat>
 
    <xforms:output value="if (string-length(@indexes) > 0) then concat('#', @indexes) else ''" />
 
  <xforms:output value="@alert" mediatype="text/html" />
 

If I remove <xforms:group ref=".[@isRelevant = 'true']"> it works. There seems to be another bug, that xforms:repeat repeats some nodes twice altough they are only once in the instance if I look errors-instance with inspector.



Mauno wrote
Thanks  Alex!
I'll use xforms-disabled/enabed way, it sounds best. That way I can easily make send-button disabled if errors instance contains errors whose relative-flag is true.


Alessandro Vernet wrote
On Mar 26, 2008, at 1:34 AM, Mauno wrote:
> Here you go. After form has loaded select "yep" from "Do you have a
> partner"-select. It will cause "partners age" control to become
> non-relevant.  After "partners age" disappears, it's error still  
> remains in
> errors-instace. http://www.nabble.com/file/p16297674/xforms-test.zip
> xforms-test.zip

I did this in the attached file, which is an update on your  
view.xhtml. This involves storing the path to the node when we get the  
xforms-invalid event in the errors instance, and then checking that  
this node is relevant when we show errors in the table.

This code uses the saxon:path() and saxon:evaluate(), which are always  
"kind of hack", and which is also won't necessarily get you the best  
performance. I think it would be better to try to react to the xforms-
disabled and xforms-enabled event, and update a flag on the error  
element to say if the corresponding element is relevant or not. You  
might want to try try to do this instead of what I did.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/