Sorry, posted with wrong topic :(
Repost with the correct one.. Hi all, I've been reading the code for creating a configurable error summary: http://www.orbeon.com/blog/2006/08/04/ Everything looks simple. However, I'm a bit lost, where do we define the rule? Ie. Where do we define the rule for firstname (must contain letters, etc). Could anyone possible give me light on this? I've been looking at the DMV form example in orbeon.com, but it seems very complicated. And I cant find where the rule is being defined. Any help would be very much appreciated. -- 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 |
And also I'm not too sure where to put the errors:
<errors> <error id="xforms-element-133" indexes="" label="First Name" alert="Must contain..."/> <error id="xforms-element-227" indexes="" label="Zip Code" alert="Must contain..."/> <error id="xforms-element-207" indexes="" label="Street Name 1" alert="Must contain..."/> <error id="xforms-element-216" indexes="" label="City" alert="Must contain..."/> </errors> I think it should be inside <head></head> And what's the id correspond to? :) Thanks so much :) Cheers, Christian -----Original Message----- From: Christian Lebe Sent: Wednesday, 11 July 2007 6:39 PM To: [hidden email] Subject: [ops-users] Creating quick form validation Sorry, posted with wrong topic :( Repost with the correct one.. Hi all, I've been reading the code for creating a configurable error summary: http://www.orbeon.com/blog/2006/08/04/ Everything looks simple. However, I'm a bit lost, where do we define the rule? Ie. Where do we define the rule for firstname (must contain letters, etc). Could anyone possible give me light on this? I've been looking at the DMV form example in orbeon.com, but it seems very complicated. And I cant find where the rule is being defined. Any help would be very much appreciated. -- 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 |
Administrator
|
In reply to this post by Christian Lebe-2
Christian Lebe wrote:
> Sorry, posted with wrong topic :( > Repost with the correct one.. > > > Hi all, > > I've been reading the code for creating a configurable error summary: > > http://www.orbeon.com/blog/2006/08/04/ > > Everything looks simple. However, I'm a bit lost, where do we define the > rule? Ie. Where do we define the rule for firstname (must contain > letters, etc). > > Could anyone possible give me light on this? I've been looking at the > DMV form example in orbeon.com, but it seems very complicated. And I > cant find where the rule is being defined. > > > Any help would be very much appreciated. * You can use an XML Schema, which you import with: <xforms:model schema="my-schema.xsd"> This is what the Government Forms does. * You can use <xforms:bind>, and set types and constraints properties on it. Some of the complexity of the Government Forms example comes from the fact that it deals with multiple forms, and for each form it has to piece together the relevant bits. -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 |
In reply to this post by Christian Lebe-2
Thanks Eric, Okay let me elaborate it more :) 1. First thing I did is defining the error template (Exactly copied from orbeon blog) <xforms:instance id="errors-instance"> <errors xmlns=""/> </xforms:instance> <xforms:instance id="error-template"> <error xmlns="" id="" indexes="" label="" alert=""/> </xforms:instance> 2. Add event handlers: (Exactly copied from orbeon blog) <xforms:action ev:event="xforms-invalid" if="normalize-space(event('alert')) != ''"> <xforms:action if="not(instance('errors-instance')/error[@id = event('target-id') 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-id')"/> <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-id') and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" value="event('alert')"/> <xforms:setvalue ref="instance('errors-instance')/error[@id = event('target-id') and @indexes = string-join(event('repeat-indexes'), '-')]/@label" value="event('label')"/> </xforms:action> <xforms:action ev:event="xforms-valid" if="instance('errors-instance')/error[@id = event('target-id') and @indexes = string-join(event('repeat-indexes'), '-')]"> <xforms:delete nodeset="instance('errors-instance')/error[@id = event('target-id') and @indexes = string-join(event('repeat-indexes'), '-')]"/> </xforms:action> I have these following bind nodeset to be checked: <xf:bind nodeset="instance('xform')/data"> <xf:bind nodeset="prefix" required="true()" /> <xf:bind id="first-name" nodeset="first-name" required="true()" constraint=". castable as xs:integer and . >= 1 and 12 >= ." /> <xf:bind nodeset="last-name" required="true()" /> <xf:bind nodeset="purpose" required="true()" /> <xf:bind nodeset="accomodation" required="true()" /> </xf:bind> Say I'm only interested to check first-name node over there… I know it's silly to have firstname of number between 1 to 12. But for the sake of example… And then I defined the errors inside <body> tag <errors> <error id="first-name" indexes="" label="First Name" alert="Must contain..."/> </errors> And put the XForms controls to display the error: (Exactly copied from orbeon blog), I copied the css of dmv-errors-table. <xforms:group ref="instance('errors-instance')/error"> <table class="dmv-errors-table"> <xforms:repeat nodeset="instance('errors-instance')/error" id="errors-repeat"> <tr> <th><xforms:output value="@label"/></th> <td> <xforms:output value="if (string-length(@indexes) > 0) then concat('(Row ', @indexes, ')') else ''"/> </td> <td><xforms:output value="@alert"/></td> </tr> </xforms:repeat> </table> </xforms:group> I can see it's doing the check and the constraint works (it displays the exclamation sign), however, it does not populate the error instance. Any idea about this? Thanks heaps guys J
Christian
-----Original Message----- Christian Lebe wrote: > Sorry, posted with wrong topic :( > Repost with the correct one.. > > > Hi all, > > I've been reading the code for creating a configurable error summary: > > http://www.orbeon.com/blog/2006/08/04/ > > Everything looks simple. However, I'm a bit lost, where do we define the > rule? Ie. Where do we define the rule for firstname (must contain > letters, etc). > > Could anyone possible give me light on this? I've been looking at the > DMV form example in orbeon.com, but it seems very complicated. And I > cant find where the rule is being defined. > > > Any help would be very much appreciated. With XForms, you have two ways: * You can use an XML Schema, which you import with: <xforms:model schema="my-schema.xsd"> This is what the Government Forms does. * You can use <xforms:bind>, and set types and constraints properties on it. Some of the complexity of the Government Forms example comes from the fact that it deals with multiple forms, and for each form it has to piece together the relevant bits. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way -- 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 |
Administrator
|
Christian,
The easiest way for us to look at this is for you to attach a sample that runs in the sandbox. See: http://www.orbeon.com/ops/doc/home-faq#reporting-issues -Erik Christian Lebe wrote: > Thanks Eric, > > Okay let me elaborate it more :) > > 1. First thing I did is defining the error template (Exactly copied from > orbeon blog) > > <xforms:instance id="errors-instance"> > > <errors xmlns=""/> > > </xforms:instance> > > <xforms:instance id="error-template"> > > <error xmlns="" id="" indexes="" label="" alert=""/> > > </xforms:instance> > > 2. Add event handlers: (Exactly copied from orbeon blog) > > > <xforms:action ev:event="xforms-invalid" > if="normalize-space(event('alert')) != ''"> > > <xforms:action if="not(instance('errors-instance')/error[@id = > event('target-id') > > 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-id')"/> > > <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-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" > value="event('alert')"/> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@label" > value="event('label')"/> > > </xforms:action> > > <xforms:action ev:event="xforms-valid" > if="instance('errors-instance')/error[@id = event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"> > > <xforms:delete nodeset="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"/> > > </xforms:action> > > I have these following bind nodeset to be checked: > > <xf:bind nodeset="instance('xform')/data"> > > <xf:bind nodeset="prefix" required="true()" /> > > <xf:bind id="first-name" nodeset="first-name" > required="true()" constraint=". castable as xs:integer and . >= 1 and 12 > >= ." /> > > <xf:bind nodeset="last-name" required="true()" /> > > <xf:bind nodeset="purpose" required="true()" /> > > <xf:bind nodeset="accomodation" required="true()" /> > > </xf:bind> > > Say I'm only interested to check first-name node over there… I know it's > silly to have firstname of number between 1 to 12. > > But for the sake of example… > > And then I defined the errors inside <body> tag > > <errors> > > <error id="first-name" indexes="" label="First Name" alert="Must > contain..."/> > > </errors> > > And put the XForms controls to display the error: (Exactly copied from > orbeon blog), I copied the css of dmv-errors-table. > > <xforms:group ref="instance('errors-instance')/error"> > > <table class="dmv-errors-table"> > > <xforms:repeat nodeset="instance('errors-instance')/error" > id="errors-repeat"> > > <tr> > > <th><xforms:output value="@label"/></th> > > <td> > > <xforms:output value="if (string-length(@indexes) > 0) > > then concat('(Row ', @indexes, ')') else ''"/> > > </td> > > <td><xforms:output value="@alert"/></td> > > </tr> > > </xforms:repeat> > > </table> > > </xforms:group> > > I can see it's doing the check and the constraint works (it displays the > exclamation sign), however, it does not populate the error instance. > > Any idea about this? Thanks heaps guys J > > > Cheers, > > > > Christian > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Wednesday, 11 July 2007 6:53 PM > To: [hidden email] > Subject: Re: [ops-users] Creating quick form validation > > Christian Lebe wrote: > >> Sorry, posted with wrong topic :( > >> Repost with the correct one.. > >> > >> > >> Hi all, > >> > >> I've been reading the code for creating a configurable error summary: > >> > >> http://www.orbeon.com/blog/2006/08/04/ > >> > >> Everything looks simple. However, I'm a bit lost, where do we define the > >> rule? Ie. Where do we define the rule for firstname (must contain > >> letters, etc). > >> > >> Could anyone possible give me light on this? I've been looking at the > >> DMV form example in orbeon.com, but it seems very complicated. And I > >> cant find where the rule is being defined. > >> > >> > >> Any help would be very much appreciated. > > With XForms, you have two ways: > > * You can use an XML Schema, which you import with: > > <xforms:model schema="my-schema.xsd"> > > This is what the Government Forms does. > > * You can use <xforms:bind>, and set types and constraints properties on > > it. > > Some of the complexity of the Government Forms example comes from the > > fact that it deals with multiple forms, and for each form it has to > > piece together the relevant bits. > > -Erik > > -- > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way > > http://www.orbeon.com/ > -- 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 |
In reply to this post by Christian Lebe-2
Thanks for your reply Erik,
Okay, I've converted and removed some lines, attached is snippet of the code. Still the same thing, it doesn't want to populate the <error> instances. Any feedback would be very appreciated. Cheers, Christian -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] Sent: Thursday, 12 July 2007 4:35 PM To: [hidden email] Subject: Re: [ops-users] Creating quick form validation Christian, The easiest way for us to look at this is for you to attach a sample that runs in the sandbox. See: http://www.orbeon.com/ops/doc/home-faq#reporting-issues -Erik Christian Lebe wrote: > Thanks Eric, > > Okay let me elaborate it more :) > > 1. First thing I did is defining the error template (Exactly copied from > orbeon blog) > > <xforms:instance id="errors-instance"> > > <errors xmlns=""/> > > </xforms:instance> > > <xforms:instance id="error-template"> > > <error xmlns="" id="" indexes="" label="" alert=""/> > > </xforms:instance> > > 2. Add event handlers: (Exactly copied from orbeon blog) > > > <xforms:action ev:event="xforms-invalid" > if="normalize-space(event('alert')) != ''"> > > <xforms:action if="not(instance('errors-instance')/error[@id = > event('target-id') > > 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-id')"/> > > <xforms:setvalue > > > value="string-join(event('repeat-indexes'), '-')"/> > > </xforms:action> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" > value="event('alert')"/> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@label" > value="event('label')"/> > > </xforms:action> > > <xforms:action ev:event="xforms-valid" > if="instance('errors-instance')/error[@id = event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"> > > <xforms:delete nodeset="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"/> > > </xforms:action> > > I have these following bind nodeset to be checked: > > <xf:bind nodeset="instance('xform')/data"> > > <xf:bind nodeset="prefix" required="true()" /> > > <xf:bind id="first-name" nodeset="first-name" > required="true()" constraint=". castable as xs:integer and . >= 1 and > >= ." /> > > <xf:bind nodeset="last-name" required="true()" /> > > <xf:bind nodeset="purpose" required="true()" /> > > <xf:bind nodeset="accomodation" required="true()" /> > > </xf:bind> > > Say I'm only interested to check first-name node over there... I know > silly to have firstname of number between 1 to 12. > > But for the sake of example... > > And then I defined the errors inside <body> tag > > <errors> > > <error id="first-name" indexes="" label="First Name" alert="Must > contain..."/> > > </errors> > > And put the XForms controls to display the error: (Exactly copied from > orbeon blog), I copied the css of dmv-errors-table. > > <xforms:group ref="instance('errors-instance')/error"> > > <table class="dmv-errors-table"> > > <xforms:repeat nodeset="instance('errors-instance')/error" > id="errors-repeat"> > > <tr> > > <th><xforms:output value="@label"/></th> > > <td> > > <xforms:output value="if (string-length(@indexes) > 0) > > then concat('(Row ', @indexes, ')') else ''"/> > > </td> > > <td><xforms:output value="@alert"/></td> > > </tr> > > </xforms:repeat> > > </table> > > </xforms:group> > > I can see it's doing the check and the constraint works (it displays > exclamation sign), however, it does not populate the error instance. > > Any idea about this? Thanks heaps guys J > > > Cheers, > > > > Christian > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Wednesday, 11 July 2007 6:53 PM > To: [hidden email] > Subject: Re: [ops-users] Creating quick form validation > > Christian Lebe wrote: > >> Sorry, posted with wrong topic :( > >> Repost with the correct one.. > >> > >> > >> Hi all, > >> > >> I've been reading the code for creating a configurable error > >> > >> http://www.orbeon.com/blog/2006/08/04/ > >> > >> Everything looks simple. However, I'm a bit lost, where do we define > >> rule? Ie. Where do we define the rule for firstname (must contain > >> letters, etc). > >> > >> Could anyone possible give me light on this? I've been looking at the > >> DMV form example in orbeon.com, but it seems very complicated. And I > >> cant find where the rule is being defined. > >> > >> > >> Any help would be very much appreciated. > > With XForms, you have two ways: > > * You can use an XML Schema, which you import with: > > <xforms:model schema="my-schema.xsd"> > > This is what the Government Forms does. > > * You can use <xforms:bind>, and set types and constraints properties > > it. > > Some of the complexity of the Government Forms example comes from the > > fact that it deals with multiple forms, and for each form it has to > > piece together the relevant bits. > > -Erik > > -- > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way > > http://www.orbeon.com/ > -- 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 error-checking.xhtml (12K) Download Attachment |
In reply to this post by Christian Lebe-2
Hi Erik, Been reading the tutorial again. And I did some flaw in my own code. Been trying to fix it, but it's still not working. I'm quite sure the constraint is correct, I can see the exclamation mark showing and the alert. However, it doesn't seem to trigger the xforms-invalid event, the errors-instance do not get populated. I have attached the xhtml compatible in sandbox. Any feedback would be very appreciated. Cheers, Christian -----Original Message----- From: Christian Lebe Sent: Thursday, 12 July 2007 5:24 PM To: [hidden email] Subject: RE: [ops-users] Creating quick form validation Thanks for your reply Erik, Okay, I've converted and removed some lines, attached is snippet of the code. Still the same thing, it doesn't want to populate the <error> instances. Any feedback would be very appreciated. Cheers, Christian -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] Sent: Thursday, 12 July 2007 4:35 PM To: [hidden email] Subject: Re: [ops-users] Creating quick form validation Christian, The easiest way for us to look at this is for you to attach a sample that runs in the sandbox. See: http://www.orbeon.com/ops/doc/home-faq#reporting-issues -Erik Christian Lebe wrote: > Thanks Eric, > > Okay let me elaborate it more :) > > 1. First thing I did is defining the error template (Exactly copied from > orbeon blog) > > <xforms:instance id="errors-instance"> > > <errors xmlns=""/> > > </xforms:instance> > > <xforms:instance id="error-template"> > > <error xmlns="" id="" indexes="" label="" alert=""/> > > </xforms:instance> > > 2. Add event handlers: (Exactly copied from orbeon blog) > > > <xforms:action ev:event="xforms-invalid" > if="normalize-space(event('alert')) != ''"> > > <xforms:action if="not(instance('errors-instance')/error[@id = > event('target-id') > > 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-id')"/> > > <xforms:setvalue > > > value="string-join(event('repeat-indexes'), '-')"/> > > </xforms:action> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" > value="event('alert')"/> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@label" > value="event('label')"/> > > </xforms:action> > > <xforms:action ev:event="xforms-valid" > if="instance('errors-instance')/error[@id = event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"> > > <xforms:delete nodeset="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"/> > > </xforms:action> > > I have these following bind nodeset to be checked: > > <xf:bind nodeset="instance('xform')/data"> > > <xf:bind nodeset="prefix" required="true()" /> > > <xf:bind id="first-name" nodeset="first-name" > required="true()" constraint=". castable as xs:integer and . >= 1 and > >= ." /> > > <xf:bind nodeset="last-name" required="true()" /> > > <xf:bind nodeset="purpose" required="true()" /> > > <xf:bind nodeset="accomodation" required="true()" /> > > </xf:bind> > > Say I'm only interested to check first-name node over there... I know > silly to have firstname of number between 1 to 12. > > But for the sake of example... > > And then I defined the errors inside <body> tag > > <errors> > > <error id="first-name" indexes="" label="First Name" alert="Must > contain..."/> > > </errors> > > And put the XForms controls to display the error: (Exactly copied from > orbeon blog), I copied the css of dmv-errors-table. > > <xforms:group ref="instance('errors-instance')/error"> > > <table class="dmv-errors-table"> > > <xforms:repeat nodeset="instance('errors-instance')/error" > id="errors-repeat"> > > <tr> > > <th><xforms:output value="@label"/></th> > > <td> > > <xforms:output value="if (string-length(@indexes) > 0) > > then concat('(Row ', @indexes, ')') else ''"/> > > </td> > > <td><xforms:output value="@alert"/></td> > > </tr> > > </xforms:repeat> > > </table> > > </xforms:group> > > I can see it's doing the check and the constraint works (it displays > exclamation sign), however, it does not populate the error instance. > > Any idea about this? Thanks heaps guys J > > > Cheers, > > > > Christian > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Wednesday, 11 July 2007 6:53 PM > To: [hidden email] > Subject: Re: [ops-users] Creating quick form validation > > Christian Lebe wrote: > >> Sorry, posted with wrong topic :( > >> Repost with the correct one.. > >> > >> > >> Hi all, > >> > >> I've been reading the code for creating a configurable error > >> > >> http://www.orbeon.com/blog/2006/08/04/ > >> > >> Everything looks simple. However, I'm a bit lost, where do we define > >> rule? Ie. Where do we define the rule for firstname (must contain > >> letters, etc). > >> > >> Could anyone possible give me light on this? I've been looking at the > >> DMV form example in orbeon.com, but it seems very complicated. And I > >> cant find where the rule is being defined. > >> > >> > >> Any help would be very much appreciated. > > With XForms, you have two ways: > > * You can use an XML Schema, which you import with: > > <xforms:model schema="my-schema.xsd"> > > This is what the Government Forms does. > > * You can use <xforms:bind>, and set types and constraints properties > > it. > > Some of the complexity of the Government Forms example comes from the > > fact that it deals with multiple forms, and for each form it has to > > piece together the relevant bits. > > -Erik > > -- > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way > > http://www.orbeon.com/ > -- 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 |
In reply to this post by Christian Lebe-2
Sorry,
Forgot to attach the xml file. Cheers, Christian -----Original Message----- From: Christian Lebe Sent: Monday, 16 July 2007 9:29 AM To: [hidden email] Subject: RE: [ops-users] Creating quick form validation Hi Erik, Been reading the tutorial again. And I did some flaw in my own code. Been trying to fix it, but it's still not working. I'm quite sure the constraint is correct, I can see the exclamation mark showing and the alert. However, it doesn't seem to trigger the xforms-invalid event, the errors-instance do not get populated. I have attached the xhtml compatible in sandbox. Any feedback would be very appreciated. Cheers, Christian -----Original Message----- From: Christian Lebe Sent: Thursday, 12 July 2007 5:24 PM To: [hidden email] Subject: RE: [ops-users] Creating quick form validation Thanks for your reply Erik, Okay, I've converted and removed some lines, attached is snippet of the code. Still the same thing, it doesn't want to populate the <error> instances. Any feedback would be very appreciated. Cheers, Christian -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] Sent: Thursday, 12 July 2007 4:35 PM To: [hidden email] Subject: Re: [ops-users] Creating quick form validation Christian, The easiest way for us to look at this is for you to attach a sample that runs in the sandbox. See: http://www.orbeon.com/ops/doc/home-faq#reporting-issues -Erik Christian Lebe wrote: > Thanks Eric, > > Okay let me elaborate it more :) > > 1. First thing I did is defining the error template (Exactly copied from > orbeon blog) > > <xforms:instance id="errors-instance"> > > <errors xmlns=""/> > > </xforms:instance> > > <xforms:instance id="error-template"> > > <error xmlns="" id="" indexes="" label="" alert=""/> > > </xforms:instance> > > 2. Add event handlers: (Exactly copied from orbeon blog) > > > <xforms:action ev:event="xforms-invalid" > if="normalize-space(event('alert')) != ''"> > > <xforms:action if="not(instance('errors-instance')/error[@id = > event('target-id') > > 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-id')"/> > > <xforms:setvalue > > > value="string-join(event('repeat-indexes'), '-')"/> > > </xforms:action> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" > value="event('alert')"/> > > <xforms:setvalue ref="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]/@label" > value="event('label')"/> > > </xforms:action> > > <xforms:action ev:event="xforms-valid" > if="instance('errors-instance')/error[@id = event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"> > > <xforms:delete nodeset="instance('errors-instance')/error[@id = > event('target-id') > > and @indexes = string-join(event('repeat-indexes'), '-')]"/> > > </xforms:action> > > I have these following bind nodeset to be checked: > > <xf:bind nodeset="instance('xform')/data"> > > <xf:bind nodeset="prefix" required="true()" /> > > <xf:bind id="first-name" nodeset="first-name" > required="true()" constraint=". castable as xs:integer and . >= 1 and > >= ." /> > > <xf:bind nodeset="last-name" required="true()" /> > > <xf:bind nodeset="purpose" required="true()" /> > > <xf:bind nodeset="accomodation" required="true()" /> > > </xf:bind> > > Say I'm only interested to check first-name node over there... I know > silly to have firstname of number between 1 to 12. > > But for the sake of example... > > And then I defined the errors inside <body> tag > > <errors> > > <error id="first-name" indexes="" label="First Name" alert="Must > contain..."/> > > </errors> > > And put the XForms controls to display the error: (Exactly copied from > orbeon blog), I copied the css of dmv-errors-table. > > <xforms:group ref="instance('errors-instance')/error"> > > <table class="dmv-errors-table"> > > <xforms:repeat nodeset="instance('errors-instance')/error" > id="errors-repeat"> > > <tr> > > <th><xforms:output value="@label"/></th> > > <td> > > <xforms:output value="if (string-length(@indexes) > 0) > > then concat('(Row ', @indexes, ')') else ''"/> > > </td> > > <td><xforms:output value="@alert"/></td> > > </tr> > > </xforms:repeat> > > </table> > > </xforms:group> > > I can see it's doing the check and the constraint works (it displays > exclamation sign), however, it does not populate the error instance. > > Any idea about this? Thanks heaps guys J > > > Cheers, > > > > Christian > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Wednesday, 11 July 2007 6:53 PM > To: [hidden email] > Subject: Re: [ops-users] Creating quick form validation > > Christian Lebe wrote: > >> Sorry, posted with wrong topic :( > >> Repost with the correct one.. > >> > >> > >> Hi all, > >> > >> I've been reading the code for creating a configurable error > >> > >> http://www.orbeon.com/blog/2006/08/04/ > >> > >> Everything looks simple. However, I'm a bit lost, where do we define > >> rule? Ie. Where do we define the rule for firstname (must contain > >> letters, etc). > >> > >> Could anyone possible give me light on this? I've been looking at the > >> DMV form example in orbeon.com, but it seems very complicated. And I > >> cant find where the rule is being defined. > >> > >> > >> Any help would be very much appreciated. > > With XForms, you have two ways: > > * You can use an XML Schema, which you import with: > > <xforms:model schema="my-schema.xsd"> > > This is what the Government Forms does. > > * You can use <xforms:bind>, and set types and constraints properties > > it. > > Some of the complexity of the Government Forms example comes from the > > fact that it deals with multiple forms, and for each form it has to > > piece together the relevant bits. > > -Erik > > -- > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way > > http://www.orbeon.com/ > -- 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 error-checking1.xhtml (12K) Download Attachment |
In reply to this post by Christian Lebe-2
Christian,
I had a problem a couple of weeks ago with the validation code. I discovered that the event('target-id') always returned an empty string, whereas event('target') returned the id of the control that was invalid/valid. I changed all the event('target-id') references to event('target') and the code works. jack On 7/15/07 9:29 PM, "Christian Lebe" <[hidden email]> wrote: > > Hi Erik, > > Been reading the tutorial again. And I did some flaw in my own code. > Been trying to fix it, but it's still not working. > > I'm quite sure the constraint is correct, I can see the exclamation mark > showing and the alert. However, it doesn't seem to trigger the > xforms-invalid event, the errors-instance do not get populated. > > I have attached the xhtml compatible in sandbox. > > Any feedback would be very appreciated. > > Cheers, > > Christian > > -----Original Message----- > From: Christian Lebe > Sent: Thursday, 12 July 2007 5:24 PM > To: [hidden email] > Subject: RE: [ops-users] Creating quick form validation > > Thanks for your reply Erik, > > Okay, I've converted and removed some lines, attached is snippet of the > code. > > Still the same thing, it doesn't want to populate the <error> instances. > Any feedback would be very appreciated. > > Cheers, > > Christian > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Thursday, 12 July 2007 4:35 PM > To: [hidden email] > Subject: Re: [ops-users] Creating quick form validation > > Christian, > > The easiest way for us to look at this is for you to attach a sample > that runs in the sandbox. See: > > http://www.orbeon.com/ops/doc/home-faq#reporting-issues > > -Erik > > Christian Lebe wrote: >> Thanks Eric, >> >> Okay let me elaborate it more :) >> >> 1. First thing I did is defining the error template (Exactly copied > from >> orbeon blog) >> >> <xforms:instance id="errors-instance"> >> >> <errors xmlns=""/> >> >> </xforms:instance> >> >> <xforms:instance id="error-template"> >> >> <error xmlns="" id="" indexes="" label="" alert=""/> >> >> </xforms:instance> >> >> 2. Add event handlers: (Exactly copied from orbeon blog) >> >> >> <xforms:action ev:event="xforms-invalid" >> if="normalize-space(event('alert')) != ''"> >> >> <xforms:action if="not(instance('errors-instance')/error[@id = >> event('target-id') >> >> 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-id')"/> >> >> <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-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" >> value="event('alert')"/> >> >> <xforms:setvalue ref="instance('errors-instance')/error[@id = >> event('target-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]/@label" >> value="event('label')"/> >> >> </xforms:action> >> >> <xforms:action ev:event="xforms-valid" >> if="instance('errors-instance')/error[@id = event('target-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]"> >> >> <xforms:delete nodeset="instance('errors-instance')/error[@id = >> event('target-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]"/> >> >> </xforms:action> >> >> I have these following bind nodeset to be checked: >> >> <xf:bind nodeset="instance('xform')/data"> >> >> <xf:bind nodeset="prefix" required="true()" /> >> >> <xf:bind id="first-name" nodeset="first-name" >> required="true()" constraint=". castable as xs:integer and . >= 1 and > 12 >>> = ." /> >> >> <xf:bind nodeset="last-name" required="true()" /> >> >> <xf:bind nodeset="purpose" required="true()" /> >> >> <xf:bind nodeset="accomodation" required="true()" /> >> >> </xf:bind> >> >> Say I'm only interested to check first-name node over there... I know > it's >> silly to have firstname of number between 1 to 12. >> >> But for the sake of example... >> >> And then I defined the errors inside <body> tag >> >> <errors> >> >> <error id="first-name" indexes="" label="First Name" alert="Must >> contain..."/> >> >> </errors> >> >> And put the XForms controls to display the error: (Exactly copied from > >> orbeon blog), I copied the css of dmv-errors-table. >> >> <xforms:group ref="instance('errors-instance')/error"> >> >> <table class="dmv-errors-table"> >> >> <xforms:repeat nodeset="instance('errors-instance')/error" >> id="errors-repeat"> >> >> <tr> >> >> <th><xforms:output value="@label"/></th> >> >> <td> >> >> <xforms:output value="if (string-length(@indexes) > 0) >> >> then concat('(Row ', @indexes, ')') else ''"/> >> >> </td> >> >> <td><xforms:output value="@alert"/></td> >> >> </tr> >> >> </xforms:repeat> >> >> </table> >> >> </xforms:group> >> >> I can see it's doing the check and the constraint works (it displays > the >> exclamation sign), however, it does not populate the error instance. >> >> Any idea about this? Thanks heaps guys J >> >> >> Cheers, >> >> >> >> Christian >> >> -----Original Message----- >> From: Erik Bruchez [mailto:[hidden email]] >> Sent: Wednesday, 11 July 2007 6:53 PM >> To: [hidden email] >> Subject: Re: [ops-users] Creating quick form validation >> >> Christian Lebe wrote: >> >>> Sorry, posted with wrong topic :( >> >>> Repost with the correct one.. >> >>> >> >>> >> >>> Hi all, >> >>> >> >>> I've been reading the code for creating a configurable error > summary: >> >>> >> >>> http://www.orbeon.com/blog/2006/08/04/ >> >>> >> >>> Everything looks simple. However, I'm a bit lost, where do we define > the >> >>> rule? Ie. Where do we define the rule for firstname (must contain >> >>> letters, etc). >> >>> >> >>> Could anyone possible give me light on this? I've been looking at > the >> >>> DMV form example in orbeon.com, but it seems very complicated. And I >> >>> cant find where the rule is being defined. >> >>> >> >>> >> >>> Any help would be very much appreciated. >> >> With XForms, you have two ways: >> >> * You can use an XML Schema, which you import with: >> >> <xforms:model schema="my-schema.xsd"> >> >> This is what the Government Forms does. >> >> * You can use <xforms:bind>, and set types and constraints properties > on >> >> it. >> >> Some of the complexity of the Government Forms example comes from the >> >> fact that it deals with multiple forms, and for each form it has to >> >> piece together the relevant bits. >> >> -Erik >> >> -- >> >> Orbeon Forms - Web Forms for the Enterprise Done the Right Way >> >> http://www.orbeon.com/ >> > Jack Cox CapTech Ventures, Inc. 1118 W. Main St. Richmond, VA 23220 804-545-8765 -- 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 |
Administrator
|
In reply to this post by Christian Lebe-2
As somebody else suggested as well, try to change event('target-id') to
event('target'). -Erik Christian Lebe wrote: > Sorry, > > Forgot to attach the xml file. > > Cheers, > > Christian > > -----Original Message----- > From: Christian Lebe > Sent: Monday, 16 July 2007 9:29 AM > To: [hidden email] > Subject: RE: [ops-users] Creating quick form validation > > > Hi Erik, > > Been reading the tutorial again. And I did some flaw in my own code. > Been trying to fix it, but it's still not working. > > I'm quite sure the constraint is correct, I can see the exclamation mark > showing and the alert. However, it doesn't seem to trigger the > xforms-invalid event, the errors-instance do not get populated. > > I have attached the xhtml compatible in sandbox. > > Any feedback would be very appreciated. > > Cheers, > > Christian > > -----Original Message----- > From: Christian Lebe > Sent: Thursday, 12 July 2007 5:24 PM > To: [hidden email] > Subject: RE: [ops-users] Creating quick form validation > > Thanks for your reply Erik, > > Okay, I've converted and removed some lines, attached is snippet of the > code. > > Still the same thing, it doesn't want to populate the <error> instances. > Any feedback would be very appreciated. > > Cheers, > > Christian > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] > Sent: Thursday, 12 July 2007 4:35 PM > To: [hidden email] > Subject: Re: [ops-users] Creating quick form validation > > Christian, > > The easiest way for us to look at this is for you to attach a sample > that runs in the sandbox. See: > > http://www.orbeon.com/ops/doc/home-faq#reporting-issues > > -Erik > > Christian Lebe wrote: >> Thanks Eric, >> >> Okay let me elaborate it more :) >> >> 1. First thing I did is defining the error template (Exactly copied > from >> orbeon blog) >> >> <xforms:instance id="errors-instance"> >> >> <errors xmlns=""/> >> >> </xforms:instance> >> >> <xforms:instance id="error-template"> >> >> <error xmlns="" id="" indexes="" label="" alert=""/> >> >> </xforms:instance> >> >> 2. Add event handlers: (Exactly copied from orbeon blog) >> >> >> <xforms:action ev:event="xforms-invalid" >> if="normalize-space(event('alert')) != ''"> >> >> <xforms:action if="not(instance('errors-instance')/error[@id = >> event('target-id') >> >> 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-id')"/> >> >> <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-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]/@alert" >> value="event('alert')"/> >> >> <xforms:setvalue ref="instance('errors-instance')/error[@id = >> event('target-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]/@label" >> value="event('label')"/> >> >> </xforms:action> >> >> <xforms:action ev:event="xforms-valid" >> if="instance('errors-instance')/error[@id = event('target-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]"> >> >> <xforms:delete nodeset="instance('errors-instance')/error[@id = >> event('target-id') >> >> and @indexes = string-join(event('repeat-indexes'), '-')]"/> >> >> </xforms:action> >> >> I have these following bind nodeset to be checked: >> >> <xf:bind nodeset="instance('xform')/data"> >> >> <xf:bind nodeset="prefix" required="true()" /> >> >> <xf:bind id="first-name" nodeset="first-name" >> required="true()" constraint=". castable as xs:integer and . >= 1 and > 12 >> >= ." /> >> >> <xf:bind nodeset="last-name" required="true()" /> >> >> <xf:bind nodeset="purpose" required="true()" /> >> >> <xf:bind nodeset="accomodation" required="true()" /> >> >> </xf:bind> >> >> Say I'm only interested to check first-name node over there... I know > it's >> silly to have firstname of number between 1 to 12. >> >> But for the sake of example... >> >> And then I defined the errors inside <body> tag >> >> <errors> >> >> <error id="first-name" indexes="" label="First Name" alert="Must >> contain..."/> >> >> </errors> >> >> And put the XForms controls to display the error: (Exactly copied from > >> orbeon blog), I copied the css of dmv-errors-table. >> >> <xforms:group ref="instance('errors-instance')/error"> >> >> <table class="dmv-errors-table"> >> >> <xforms:repeat nodeset="instance('errors-instance')/error" >> id="errors-repeat"> >> >> <tr> >> >> <th><xforms:output value="@label"/></th> >> >> <td> >> >> <xforms:output value="if (string-length(@indexes) > 0) >> >> then concat('(Row ', @indexes, ')') else ''"/> >> >> </td> >> >> <td><xforms:output value="@alert"/></td> >> >> </tr> >> >> </xforms:repeat> >> >> </table> >> >> </xforms:group> >> >> I can see it's doing the check and the constraint works (it displays > the >> exclamation sign), however, it does not populate the error instance. >> >> Any idea about this? Thanks heaps guys J >> >> >> Cheers, >> >> >> >> Christian >> >> -----Original Message----- >> From: Erik Bruchez [mailto:[hidden email]] >> Sent: Wednesday, 11 July 2007 6:53 PM >> To: [hidden email] >> Subject: Re: [ops-users] Creating quick form validation >> >> Christian Lebe wrote: >> >>> Sorry, posted with wrong topic :( >>> Repost with the correct one.. >>> Hi all, >>> I've been reading the code for creating a configurable error > summary: >>> http://www.orbeon.com/blog/2006/08/04/ >>> Everything looks simple. However, I'm a bit lost, where do we define > the >>> rule? Ie. Where do we define the rule for firstname (must contain >>> letters, etc). >>> Could anyone possible give me light on this? I've been looking at > the >>> DMV form example in orbeon.com, but it seems very complicated. And I >>> cant find where the rule is being defined. >>> Any help would be very much appreciated. >> With XForms, you have two ways: >> >> * You can use an XML Schema, which you import with: >> >> <xforms:model schema="my-schema.xsd"> >> >> This is what the Government Forms does. >> >> * You can use <xforms:bind>, and set types and constraints properties > on >> it. >> >> Some of the complexity of the Government Forms example comes from the >> >> fact that it deals with multiple forms, and for each form it has to >> >> piece together the relevant bits. >> >> -Erik >> >> -- >> >> Orbeon Forms - Web Forms for the Enterprise Done the Right Way >> >> http://www.orbeon.com/ >> > > -- 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 |
Free forum by Nabble | Edit this page |