Bug when inserting <xhtml:img> elements within <xforms:repeat>?

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

Re: Capturing xforms-invalid

Vincent Bonamy-2
Hi,
I think (not sure at all) the xforms-invalid event occurs only when
model is not valid with respect to a specified xml schema.
In the Government Forms example you will find something like
<xforms:model id="dmv-model" schema="oxf:/apps/forms/forms/DMV-14/schema.xsd"  
for example.
So in your example, instead of putting xs:int via a xf:bind syntax, I
suggest you to try to put this constraint in a xml schema.

Vincent.


Larry T. Chen a écrit :

> Florian,
>
> Thanks for the reply.  In the Government Forms example, the
> xforms-invalid event appears to be captured at the model, so that it's
> able to capture all xforms-invalid events for all input controls.
>
> <xforms:group model="common-model">
>                     <!-- Handle invalid and valid events in order to update error summary -->
>                     <xforms:action ev:event="xforms-invalid" if="normalize-space(event('alert')) != ''">
>                         <xforms:action if="not(instance('errors-instance')/error[@id = event('target') and @indexes = string-join(event('repeat-indexes'), '-')])">
>                             <xforms:insert context="instance('errors-instance')" nodeset="error" origin="instance('error-template')"/>
>                             <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@id" value="event('target')"/>
>                             <xforms:setvalue ref="instance('errors-instance')/error[index('errors-repeat')]/@indexes" value="string-join(event('repeat-indexes'), '-')"/>
>                         </xforms:action>
>                         <xforms:setvalue ref="instance('errors-instance')/error[@id = event('target') and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" value="event('alert')"/>
>                         <xforms:setvalue ref="instance('errors-instance')/error[@id = event('target') and @indexes = string-join(event('repeat-indexes'), '-')]/@label" value="event('label')"/>
>                     </xforms:action>
> ....
> </xforms:group>
>
> I've been trying to reuse the error summary code from Government Forms
> in my own forms, but since I could not get it to work, I produced a
> simple example to narrow down the problem.
>
> So I'm still confused ... Why does the Government Forms example work
> and not my simple example (see my previous post) ?
>
> Larry
>
>
> Florian Schmitt wrote:
>
>> Hi Larry,
>>
>> Larry T. Chen schrieb:
>>
>>>    This should be a very simple thing, but I just can't see it.  Why
>>> doesn't the following work?  It should display xforms-invalid
>>> whenever I enter an invalid number.
>>
>> (...)
>>
>>>    <xhtml:body>
>>>        Enter a number: <xf:input ref="number" />
>>>        <xf:group model="default">
>>>            <xf:action ev:event="xforms-invalid">
>>>                <xf:message level="modal">xforms-invalid</xf:message>
>>>            </xf:action>
>>>        </xf:group>
>>>    </xhtml:body>
>>
>> (...)
>>
>> The following seems to work:
>> <xhtml:body>
>>     Enter a number:
>>     <xf:input ref="number">
>>         <xf:action ev:event="xforms-invalid">
>>             <xf:message level="modal">xforms-invalid</xf:message>
>>         </xf:action>
>>     </xf:input>
>> </xhtml:body>
>>
>> Maybe the cause is that the target of the xforms-invalid event is the
>> form control, not the model.
>>
>> florian
>>
>>
>>------------------------------------------------------------------------
>>
>>
>>--
>>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
>>  
>>
>
>------------------------------------------------------------------------
>
>
>--
>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
>  
>




--
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: Capturing xforms-invalid

Alessandro Vernet
Administrator
In reply to this post by Larry T. Chen
On 4/19/07, Larry T. Chen <[hidden email]> wrote:
>  So I'm still confused ... Why does the Government Forms example work and
> not my simple example (see my previous post) ?

Larry,

This is because the nodeset expression in the bind returned a empty
sequence. I modified your code to use this instead:

<xf:bind nodeset="/test/number" type="xs:int"/>

You are hitting this problem as it seems we are not setting the
context correctly in the XForms model. So for now it is better to use
absolute expressions.

I also added an incremental="true" on the xforms:input, so you the
field is validated as you type. Please find attached the modified
version.

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

gaga.xml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Capturing xforms-invalid

Alessandro Vernet
Administrator
Larry,

Forget about what I just said. Florian is 100% right: it didn't work
because of the nesting of the <xforms:group>. You can use <xf:bind
nodeset="number" type="xs:int"/> if you like; the context is set
correctly.

And Florian, yes, this is exactly as you said: the event goes to the
control, not the model.

Alex

On 4/19/07, Alessandro Vernet <[hidden email]> wrote:

> On 4/19/07, Larry T. Chen <[hidden email]> wrote:
> >  So I'm still confused ... Why does the Government Forms example work and
> > not my simple example (see my previous post) ?
>
> Larry,
>
> This is because the nodeset expression in the bind returned a empty
> sequence. I modified your code to use this instead:
>
> <xf:bind nodeset="/test/number" type="xs:int"/>
>
> You are hitting this problem as it seems we are not setting the
> context correctly in the XForms model. So for now it is better to use
> absolute expressions.
>
> I also added an incremental="true" on the xforms:input, so you the
> field is validated as you type. Please find attached the modified
> version.
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms for the Enterprise
> http://www.orbeon.com/
>
>

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

Re: Capturing xforms-invalid

Larry T. Chen
Alex,

In the Government Forms example, the xforms-invalid event is apparently going to the model ... otherwise a generic error-summary would not be possible.   So why doesn't xforms-invalid get send to the model in the case of my simple example?

In an earlier reply, Vincent Bonamy suspects that the event only gets sent to the model if the model is validated via an XML schema, otherwise it's sent to the control.  Is this true?

Larry


Alessandro Vernet wrote:
Larry,

Forget about what I just said. Florian is 100% right: it didn't work
because of the nesting of the <xforms:group>. You can use <xf:bind
nodeset="number" type="xs:int"/> if you like; the context is set
correctly.

And Florian, yes, this is exactly as you said: the event goes to the
control, not the model.

Alex

On 4/19/07, Alessandro Vernet [hidden email] wrote:
On 4/19/07, Larry T. Chen [hidden email] wrote:
>  So I'm still confused ... Why does the Government Forms example work and
> not my simple example (see my previous post) ?

Larry,

This is because the nodeset expression in the bind returned a empty
sequence. I modified your code to use this instead:

<xf:bind nodeset="/test/number" type="xs:int"/>

You are hitting this problem as it seems we are not setting the
context correctly in the XForms model. So for now it is better to use
absolute expressions.

I also added an incremental="true" on the xforms:input, so you the
field is validated as you type. Please find attached the modified
version.

Alex
--
Orbeon Forms - Web 2.0 Forms for the Enterprise
http://www.orbeon.com/





-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Capturing xforms-invalid

Alessandro Vernet
Administrator
Hi Larry,

The xforms-invalid really goes to the control bound to the invalid
node. If you look at the spec, you can see for each event if it goes
to the control or to the model. For xforms-invalid, the spec says
"Target: form control".

http://www.w3.org/TR/xforms11/#evt-invalid

In the Government Forms example, xforms-invalid is handled with a
<xforms:action ev:event="xforms-invalid"> which is in the <xhtml:body>
(not the <xforms:model>). See apps/forms/detail/detail-view.xhtml.

Alex

On 4/20/07, Larry T. Chen <[hidden email]> wrote:

>
>  Alex,
>
>  In the Government Forms example, the xforms-invalid event is apparently
> going to the model ... otherwise a generic error-summary would not be
> possible.   So why doesn't xforms-invalid get send to the model in the case
> of my simple example?
>
>  In an earlier reply, Vincent Bonamy suspects that the event only gets sent
> to the model if the model is validated via an XML schema, otherwise it's
> sent to the control.  Is this true?
>
>  Larry
>
>
>  Alessandro Vernet wrote:
> Larry,
>
>  Forget about what I just said. Florian is 100% right: it didn't work
>  because of the nesting of the <xforms:group>. You can use <xf:bind
>  nodeset="number" type="xs:int"/> if you like; the context is set
>  correctly.
>
>  And Florian, yes, this is exactly as you said: the event goes to the
>  control, not the model.
>
>  Alex
>
>  On 4/19/07, Alessandro Vernet <[hidden email]> wrote:
>
> On 4/19/07, Larry T. Chen <[hidden email]> wrote:
>  >  So I'm still confused ... Why does the Government Forms example work and
>  > not my simple example (see my previous post) ?
>
>  Larry,
>
>  This is because the nodeset expression in the bind returned a empty
>  sequence. I modified your code to use this instead:
>
>  <xf:bind nodeset="/test/number" type="xs:int"/>
>
>  You are hitting this problem as it seems we are not setting the
>  context correctly in the XForms model. So for now it is better to use
>  absolute expressions.
>
>  I also added an incremental="true" on the xforms:input, so you the
>  field is validated as you type. Please find attached the modified
>  version.
>
>  Alex
>  --
>  Orbeon Forms - Web 2.0 Forms 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
> ObjectWeb mailing lists service home page: http://www.objectweb.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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>

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

Re: Capturing xforms-invalid

Vincent Bonamy-2
Hi,

Thanks Alex for this, I didn't understand correctly events targets.

So I understand that <xforms:action ev:event="xforms-invalid">  works
because it is putted in a xforms control where context includes the
control where xforms-invalid occurs : in the Government Forms example
(apps/forms/detail/detail-view.xhtml), it's a xforms:group.

To be more clear, in attachment, the simple example xforms from Larry
which works like the Government Forms example : xforms-invalid is
catched outside the specific control of the element (== outside xf:input
"by" xf:group). If you remove xf:group here, it doesn't work anymore.


By the way ... In the Government Forms example, when we make a new form
in the UI (that is to say when we're going directly to this url
http://www.orbeon.com/ops/forms/detail/DMV-14/ ), error summary is
empty, even if there is many alerts (!) that show there are errors on
the form.
Is there a way to intialize error summary "correctly" when loading a
form (like the empty form) ?

Thanks,

Vincent.



Alessandro Vernet wrote:

> Hi Larry,
>
> The xforms-invalid really goes to the control bound to the invalid
> node. If you look at the spec, you can see for each event if it goes
> to the control or to the model. For xforms-invalid, the spec says
> "Target: form control".
>
> http://www.w3.org/TR/xforms11/#evt-invalid
>
> In the Government Forms example, xforms-invalid is handled with a
> <xforms:action ev:event="xforms-invalid"> which is in the <xhtml:body>
> (not the <xforms:model>). See apps/forms/detail/detail-view.xhtml.
>
> Alex
>
> On 4/20/07, Larry T. Chen <[hidden email]> wrote:
>>
>>  Alex,
>>
>>  In the Government Forms example, the xforms-invalid event is apparently
>> going to the model ... otherwise a generic error-summary would not be
>> possible.   So why doesn't xforms-invalid get send to the model in
>> the case
>> of my simple example?
>>
>>  In an earlier reply, Vincent Bonamy suspects that the event only
>> gets sent
>> to the model if the model is validated via an XML schema, otherwise it's
>> sent to the control.  Is this true?
>>
>>  Larry
>>
>>
>>  Alessandro Vernet wrote:
>> Larry,
>>
>>  Forget about what I just said. Florian is 100% right: it didn't work
>>  because of the nesting of the <xforms:group>. You can use <xf:bind
>>  nodeset="number" type="xs:int"/> if you like; the context is set
>>  correctly.
>>
>>  And Florian, yes, this is exactly as you said: the event goes to the
>>  control, not the model.
>>
>>  Alex
>>
>>  On 4/19/07, Alessandro Vernet <[hidden email]> wrote:
>>
>> On 4/19/07, Larry T. Chen <[hidden email]> wrote:
>>  >  So I'm still confused ... Why does the Government Forms example
>> work and
>>  > not my simple example (see my previous post) ?
>>
>>  Larry,
>>
>>  This is because the nodeset expression in the bind returned a empty
>>  sequence. I modified your code to use this instead:
>>
>>  <xf:bind nodeset="/test/number" type="xs:int"/>
>>
>>  You are hitting this problem as it seems we are not setting the
>>  context correctly in the XForms model. So for now it is better to use
>>  absolute expressions.
>>
>>  I also added an incremental="true" on the xforms:input, so you the
>>  field is validated as you type. Please find attached the modified
>>  version.
>>
>>  Alex
>>  --
>>  Orbeon Forms - Web 2.0 Forms 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
>> ObjectWeb mailing lists service home page: http://www.objectweb.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
>> ObjectWeb mailing lists service home page: http://www.objectweb.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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  


<xhtml:html xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xf="http://www.w3.org/2002/xforms"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:xhtml="http://www.w3.org/1999/xhtml">

   <xhtml:head>
       <xf:model id="default">
           <xf:instance id="data-instance">
               <test xmlns=""><number/></test>
           </xf:instance>
           <xf:bind nodeset="number" type="xs:int"/>
       </xf:model>
   </xhtml:head>
   <xhtml:body>

     <xf:group>

       <xf:action ev:event="xforms-invalid">
         <xf:message level="modal">xforms-invalid</xf:message>
       </xf:action>

       Enter a number: <xf:input ref="number" />

     </xf:group>

   </xhtml:body>
</xhtml:html>





--
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: Capturing xforms-invalid

Erik Bruchez
Administrator
Vincent,

> By the way ... In the Government Forms example, when we make a new form
> in the UI (that is to say when we're going directly to this url
> http://www.orbeon.com/ops/forms/detail/DMV-14/ ), error summary is
> empty, even if there is many alerts (!) that show there are errors on
> the form.
> Is there a way to intialize error summary "correctly" when loading a
> form (like the empty form) ?

Good point.

Currently, the XForms spec does not specify an xforms-refresh upon the
initial creation of the XForms controls, or otherwise specify that MIP
events should be dispatched upon initialization.

This means that it is currently not possible to determine the initial
status (in particular, validity) of the controls.

I sent a Last Call comment to the W3C Working Group about this issue.

A workaround is to obtain the initial document with a submission upon
xforms-ready.

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

Re: Capturing xforms-invalid

Vincent Bonamy-2
Thanks Erik,

I think the workaround works well for me :)

See attachment files, maybe there is a best solution to do but it works.

In the xforms, /ori-md-editor/service/identity point on the identity.xpl
which is a oxf:identity processor.

Note that xforms-invalid is caught (setvalue is called), but xf:message
doesn't work (maybe a "bug" ... [not a problem for what I want to do]).

Vincent.



Erik Bruchez wrote:

> Vincent,
>
>> By the way ... In the Government Forms example, when we make a new
>> form in the UI (that is to say when we're going directly to this url
>> http://www.orbeon.com/ops/forms/detail/DMV-14/ ), error summary is
>> empty, even if there is many alerts (!) that show there are errors on
>> the form.
>> Is there a way to intialize error summary "correctly" when loading a
>> form (like the empty form) ?
>
> Good point.
>
> Currently, the XForms spec does not specify an xforms-refresh upon the
> initial creation of the XForms controls, or otherwise specify that MIP
> events should be dispatched upon initialization.
>
> This means that it is currently not possible to determine the initial
> status (in particular, validity) of the controls.
>
> I sent a Last Call comment to the W3C Working Group about this issue.
>
> A workaround is to obtain the initial document with a submission upon
> xforms-ready.
>
> -Erik
>
> ------------------------------------------------------------------------
>
>
> --
> 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
>  



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

test_xforms_invalid_loading.xhtml (2K) Download Attachment
12