[opencms-dev] make required one of two fields

federico cacciapuoti fe.cacciapuoti at gmail.com
Mon Sep 3 12:18:56 CEST 2012


Thanks Antonio,

I think it's a good solution but i was looking for a workaround that
doesn't change the complete structure of the xsd file, because we already
use that xsd in a best part of the project.

I was looking for something like this,
In validation rules tag we use to do this

<validationrules>
    <rule 1....>
    <rule 2....>
    <rule 3....>
     .
     .
</validationrules>

and automatically opencms make the logic "AND"  of this rules.
I need something like this

<validationrules>
    <rule ....>
    <rule ....>
    <rule ....>
     (<rule x> or <rule y>)
     .
</validationrules>

I don't know if it's possible to make this kind of rules.

Thanks again!

2012/9/3 Antonio Cordeddu <antoniocordeddu at coranto.it>

>  Hi Federico,
>
> in this case I used this workaround: create a nested content with the
> fields (Internal, External) and then create a structured content that calls
> your nested content using a required field, like in this example:
>
>
> <xsd:complexType name=".....">
>  <xsd:sequence>
>  <xsd:element name="YourName" type="OpenCmsNestedContent" minOccurs="1"
> maxOccurs="1" />
> </xsd:sequence>
> </xsd:complexType>
>
> I hope this help you.
>
> Kind regards
> Antonio
>
>
> On 03/09/2012 11.26, federico cacciapuoti wrote:
>
> Hi to all,
>
>  I'm using opencms 7
> I have this situations:
>
>  ........
>  <xsd:complexType name=".....">
>  <xsd:sequence>
>  <xsd:element maxOccurs="1" minOccurs="0" name="Internal"
> type="OpenCmsVfsFile"/>
>  <xsd:element maxOccurs="1" minOccurs="0" name="External" type="...."/>
>  </xsd:sequence>
>  </xsd:complexType>
> ......
>
>  I need that al least one of these two fields have to be required but not
> both.
>
>  So in the workplace I can't save the changes to an "object" if I don't
> fill at least one of the two fields.
>
>  There is in opencms an option to make this?
> I was thinking to do that, using a regular expression, but i don't know if
> I can recover the fields and use them in <validationrules> tag.
>
>  Thanks.
>
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visithttp://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
> _______________________________________
> Coranto informatica di Antonio Cordeddu
> Via Torricelli, 9 09047 Selargius (CA)antoniocordeddu at coranto.it
> Skype: antonio.cordedduhttp://www.coranto.it
> ___________________________________________
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>
>


-- 
*Federico Cacciapuoti*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120903/16861b78/attachment.htm>


More information about the opencms-dev mailing list