Hello all,
Is there a way of checking, without using processors, if all the fields in a form are valid? I have a form that is validated against a schema. I want to allow the user to submit the form (change the read-only property of a trigger) if all the fields are correctly filled. I know (http://mail-archive.objectweb.org/ops-users/2005-11/msg00621.html) I can use another instance that tracks each "xforms-valid" event for each input, but I would like to do in a more "automatic" way. Thanks you, André PS - do you think the question I've posted before (Repeat and bind problem) is an Orbeon bug? -- André C. Neto Centro de Fusão Nuclear / IST Av. Rovisco Pais, 1049-001 Lisboa Portugal Phone: +351 21 8419096 / 3096 Fax: +351 21 8417819 e-mail: [hidden email] -- 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 |
Andre:
the User registration form at: http://www.orbeon.com/ops/goto-example/xforms-registration provides a good example of this. *P Andre Neto wrote: Hello all, -- 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 |
Hi,
Thanks for the answer. The example you pointed to isn't what I'm looking for, I've already looked at all the examples and couldn't find an answer to what I would like to do... I don't want to change the existing XML and add new properties that are tightly related to the view. To do this I would prefer to create a new instance only related to the view/control. I think what I'm looking for is like an automatic counter that would give me the number of valid fields... Regards, André Pascal Heus wrote: > Andre: > the User registration form at: > http://www.orbeon.com/ops/goto-example/xforms-registration > provides a good example of this. > *P > > Andre Neto wrote: > >> Hello all, >> >> Is there a way of checking, without using processors, if all the >> fields in a form are valid? >> I have a form that is validated against a schema. I want to allow the >> user to submit the form (change the read-only property of a trigger) >> if all the fields are correctly filled. I know >> (http://mail-archive.objectweb.org/ops-users/2005-11/msg00621.html) I >> can use another instance that tracks each "xforms-valid" event for >> each input, but I would like to do in a more "automatic" way. >> >> Thanks you, >> André >> >> PS - do you think the question I've posted before (Repeat and bind >> problem) is an Orbeon bug? >> >>------------------------------------------------------------------------ >> >> >>-- >>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 > > -- André C. Neto Centro de Fusão Nuclear / IST Av. Rovisco Pais, 1049-001 Lisboa Portugal Phone: +351 21 8419096 / 3096 Fax: +351 21 8417819 e-mail: [hidden email] -- 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
|
Pascal,
There is currently no perfect way of doing this, which I think it is frustrating. My use case is simple: to disable a submit button until a certain instance becomes valid. You can capture xforms-valid and xforms-invalid for each control bound to that instance, and use xforms:setvalue to set appropriate validity information in a second instance. You can then count the number of invalid values in that instance, and use a constraint, readonly, or relevant MIP based on that count to visually show whether the initial instance is valid or not. This solution becomes more difficult to implement if you have repeats. Simply counting xforms-valid and xforms-invalid may not reliably yield the correct results, as such events may be sent several times (let's say both "1" and "2" are invalid values, and the node changes from "1" to "2", then you will get xforms-value-change AND xforms-invalid sent again for that node). Another way would be to submit your instance to dummy address, with replace="none": if you catch xforms-submit-done on the submission, the instance was valid. This solution has drawbacks, such as requiring a connection to a service, and the fact that a submission error may be caused by situations other than an invalid instance. I think there should be an extension in OPS to facilitate this type of use cases. -Erik Andre Neto wrote: > Hi, > > Thanks for the answer. The example you pointed to isn't what I'm looking > for, I've already looked at all the examples and couldn't find an answer > to what I would like to do... > I don't want to change the existing XML and add new properties that are > tightly related to the view. To do this I would prefer to create a new > instance only related to the view/control. > I think what I'm looking for is like an automatic counter that would > give me the number of valid fields... > > Regards, > André > > Pascal Heus wrote: > >> Andre: >> the User registration form at: >> http://www.orbeon.com/ops/goto-example/xforms-registration >> provides a good example of this. >> *P >> >> Andre Neto wrote: >> >>> Hello all, >>> >>> Is there a way of checking, without using processors, if all the >>> fields in a form are valid? >>> I have a form that is validated against a schema. I want to allow the >>> user to submit the form (change the read-only property of a trigger) >>> if all the fields are correctly filled. I know >>> (http://mail-archive.objectweb.org/ops-users/2005-11/msg00621.html) I >>> can use another instance that tracks each "xforms-valid" event for >>> each input, but I would like to do in a more "automatic" way. >>> >>> Thanks you, >>> André >>> >>> PS - do you think the question I've posted before (Repeat and bind >>> problem) is an Orbeon bug? -- 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 |
Erik,
I've followed your suggestion of using a dummy service address. It works fine but it has a drawback that you didn't mentioned: since I'm using a schema to validate, the included XML template (that I use to create new instances of some nodes), cannot be empty otherwise it won't validate. For example: <root> <person> <name/> <surname/> </person> </root> Then the user uses the xforms to fill it up and ends up with something like: <root> <person> <name>André</name> <surname>Neto</surname> </person> <person> <name>Erik</name> <surname>Bruchez</surname> </person> <person> <name/> <surname/> </person> </root> The only way to validate this, is to enter some default values in the template. This is not a very critical problem and I think there isn't another way of doing it. Another thing that I found quite annoying, but for which you already gave a solution some time ago (http://mail-archive.objectweb.org/ops-users/2005-11/msg00608.html) is the xml:base / XInclude question, since it forces me to change the original schemas. This is not a problem though. Thank you again, André Erik Bruchez wrote: > Pascal, > > There is currently no perfect way of doing this, which I think it is > frustrating. My use case is simple: to disable a submit button until a > certain instance becomes valid. > > You can capture xforms-valid and xforms-invalid for each control bound > to that instance, and use xforms:setvalue to set appropriate validity > information in a second instance. You can then count the number of > invalid values in that instance, and use a constraint, readonly, or > relevant MIP based on that count to visually show whether the initial > instance is valid or not. > > This solution becomes more difficult to implement if you have repeats. > > Simply counting xforms-valid and xforms-invalid may not reliably yield > the correct results, as such events may be sent several times (let's > say both "1" and "2" are invalid values, and the node changes from "1" > to "2", then you will get xforms-value-change AND xforms-invalid sent > again for that node). > > Another way would be to submit your instance to dummy address, with > replace="none": if you catch xforms-submit-done on the submission, the > instance was valid. This solution has drawbacks, such as requiring a > connection to a service, and the fact that a submission error may be > caused by situations other than an invalid instance. > > I think there should be an extension in OPS to facilitate this type of > use cases. > > -Erik > > Andre Neto wrote: > >> Hi, >> >> Thanks for the answer. The example you pointed to isn't what I'm >> looking for, I've already looked at all the examples and couldn't >> find an answer to what I would like to do... >> I don't want to change the existing XML and add new properties that >> are tightly related to the view. To do this I would prefer to create >> a new instance only related to the view/control. >> I think what I'm looking for is like an automatic counter that would >> give me the number of valid fields... >> >> Regards, >> André >> >> Pascal Heus wrote: >> >>> Andre: >>> the User registration form at: >>> http://www.orbeon.com/ops/goto-example/xforms-registration >>> provides a good example of this. >>> *P >>> >>> Andre Neto wrote: >>> >>>> Hello all, >>>> >>>> Is there a way of checking, without using processors, if all the >>>> fields in a form are valid? >>>> I have a form that is validated against a schema. I want to allow >>>> the user to submit the form (change the read-only property of a >>>> trigger) if all the fields are correctly filled. I know >>>> (http://mail-archive.objectweb.org/ops-users/2005-11/msg00621.html) >>>> I can use another instance that tracks each "xforms-valid" event >>>> for each input, but I would like to do in a more "automatic" way. >>>> >>>> Thanks you, >>>> André >>>> >>>> PS - do you think the question I've posted before (Repeat and bind >>>> problem) is an Orbeon bug? >>> > > >------------------------------------------------------------------------ > > >-- >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 > > -- André C. Neto Centro de Fusão Nuclear / IST Av. Rovisco Pais, 1049-001 Lisboa Portugal Phone: +351 21 8419096 / 3096 Fax: +351 21 8417819 e-mail: [hidden email] -- 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
|
Andre,
> I've followed your suggestion of using a dummy service address. It > works fine but it has a drawback that you didn't mentioned: since > I'm using a schema to validate, the included XML template (that I > use to create new instances of some nodes), cannot be empty > otherwise it won't validate. We implement the current XForms 1.1 draft's xforms:submission/@validate attribute. If you set it to "false" on your dummy submission, you can submit even an invalid form. http://www.orbeon.com/ops/doc/reference-xforms-ng#validate-relevant-attributes > Another thing that I found quite annoying, but for which you already > gave a solution some time ago > (http://mail-archive.objectweb.org/ops-users/2005-11/msg00608.html) > is the xml:base / XInclude question, since it forces me to change > the original schemas. This is not a problem though. Yes, that's annoying. See that post by Norm Walsh for some musings on the subject: http://norman.walsh.name/2005/04/01/xinclude -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 |