Hi Reinier,
Here's a business rule for a picture that checks if a checkbox
"on_homepage" was checked.
If it is checked, then a picture the field is required otherwise it is
not. I think you could use this to do what you're trying to do.
<rule for="/document/content/picture">
<picker id="asset"/>
<validation>
<validator name="javascript">
<![CDATA[
var barWidget =
lookupWidget(widget,"/document/meta/on_homepage");
if (barWidget != false){
if (barWidget.value != false && (widget.value == null ||
widget.value.length() <= 0)){
setValidationError(widget,"A pictue is required when on
homepage is checked.");
return false;
}
}
clearValidationError(widget); // clear previous validation
errors
return true;
]]>
</validator>
</validation>
</rule>
Kind regards,
Mathijs Brand
Hippo
[EMAIL PROTECTED]
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-3329 +1 (707) 773-4646
www.onehippo.com [EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Reinier
van den Born
Sent: maandag 8 september 2008 12:14
To: Hippo CMS development public mailinglist
Subject: [HippoCMS-dev] Validating documents as a whole
Hello all,
Hippo CMS provides the possibility to add postprocessing when saving a
document.
But is there also a way to sort of "postvalidate"?
I mean, I can validate fields (eg. being required), and have the
document rejected when I try to save.
As part of that mechanism I would like to be able to define some
validation on the document as a whole.
For instance:
I have documents with a sequence of paragraphs, each paragraph having a
header and a header level.
I would like to validate a proper nesting of levels. So no level 3
directly following a level 1 header, etc.
Is there already some way to do this?
Otherwise, can someone suggest a direction to find a solution?
Reinier
--
Reinier van den Born
HintTech B.V.
Rotterdamseweg 183c, 2629 HD Delft
T: +31(0)15 268 2573
F: +31(0)15 268 2567
M: +31(0)6 494 171 36
--
HintTech levert specialisten op het gebied van softwareontwikkeling
(.NET en Java), projectmanagement, informatiebeveiliging en business
consulting.
KvK Den Haag nr. 27242282 | BTW nr. NL8062.16.396.B01
********************************************
Hippocms-dev: Hippo CMS development public mailinglist
Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html