RE: [CForms] conditional "required" attribute needed or a "better" solution
> What about an assert validation on "value"? Sounds like a good idea, so I tried it. Thanks. It doesn't work yet the way I want it to, so I've probably messed up the test, I'll look into that on Monday. However, writing the test showed that this is a very cumbersome way to handle it. As I've already explained in a previous post, the next step will be the name part where the value is not another attribute of the same element, but a set of elements that are part of the top element, i.e. John L. Doe If the name is "empty", this should be noted as: There was already a suggestion to write a custom validator, but I have no clue how to deal with these two variations in a generic way. Thanks. Bye, Helma
Re: [CForms] conditional "required" attribute needed or a "better" solution
Linden H van der (MI) wrote: Guys, can someone with in-depth knowledge of the CForms widgets help me out here? I want to build a form that can be used to enter an HL7v3 TelecomAddress[1]. The final XML result looks like this: or tel:+3112345678"/> I've managed to build the appropriate widget structure for it, but I have a problem: either 'nullFlavor' or 'value' should be used. If 'nullFlavor' is empty, then 'value' is required and consists of two required parts: 'scheme' (= tel:, selection list) and the actual number. So I defined 'value' as an aggregateField. Is it possible to define the two parts of 'value' to be required, while the aggregateField itself is not? Or is there a different solution to solve this problem? What about an assert validation on "value"? Sylvain -- Sylvain WallezAnyware Technologies http://apache.org/~sylvainhttp://anyware-tech.com Apache Software Foundation Member Research & Technology Director
RE: [CForms] conditional "required" attribute needed or a "better" solution
> What about a custom validator? Sounds like a good idea, but I have no clue how to do this in a generic way. The next XML fragment could have the value defined as a set of elements, e.g.: vs. John L. Doe How to handle both (the telecomaddress with it's value as an attribute and the name with it's value as a set of elements) without writing custom classes for everything? Bye, Helma
Re: [CForms] conditional "required" attribute needed or a "better" solution
Linden H van der (MI) wrote: Guys, can someone with in-depth knowledge of the CForms widgets help me out here? I want to build a form that can be used to enter an HL7v3 TelecomAddress[1]. The final XML result looks like this: or tel:+3112345678"/> I've managed to build the appropriate widget structure for it, but I have a problem: either 'nullFlavor' or 'value' should be used. If 'nullFlavor' is empty, then 'value' is required and consists of two required parts: 'scheme' (= tel:, selection list) and the actual number. So I defined 'value' as an aggregateField. Is it possible to define the two parts of 'value' to be required, while the aggregateField itself is not? Or is there a different solution to solve this problem? [1] HL7 = a US standards organisation in the field of Medical Informatics. HL7v3 is their 3rd version of standards, primarily defined for standardized communication of medical and personal information between (medical) systems. What about a custom validator? -- Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach {Software Engineering, Open Source, Web Applications, Apache Cocoon} web(log): http://www.poetz.cc