Validators not working in Content Block compound?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Validators not working in Content Block compound?

Roberto van der Linden
Hello,

We are using the content blocks plugin (1.08.02) and have created several compounds. Now we have created a custom validator, but this was not triggered when saving a document. After some research I found out that the 'default' validators like non-empty and required are also not triggered. (Validators located at /hippo:configuration/hippo:frontend/cms/cms-validators)

Are we missing some configuration or is it possible that the content blocks plugin just not uses the validators?

The compounds are also configured in a different namespace.

Thanks in advance,
Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Kenan Salic
Hi Roberto,

It seems the ContentBlocksFieldPlugin isn't validating the compounds (subnodes) like the NodeFieldPlugin is.

What you could do is add a validator on the content block field and validate the compounds yourself until we support this for the ContentBlocksFieldPlugin.

Kenan

On Thu, Oct 11, 2012 at 10:09 AM, Roberto van der Linden <[hidden email]> wrote:
Hello,

We are using the content blocks plugin (1.08.02) and have created several
compounds. Now we have created a custom validator, but this was not
triggered when saving a document. After some research I found out that the
'default' validators like non-empty and required are also not triggered.
(Validators located at
/hippo:configuration/hippo:frontend/cms/cms-validators)

Are we missing some configuration or is it possible that the content blocks
plugin just not uses the validators?

The compounds are also configured in a different namespace.

Thanks in advance,
Roberto



--
View this message in context: http://hippo.2275632.n2.nabble.com/Validators-not-working-in-Content-Block-compound-tp7579505.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

david
Hum, 
i'll have the exact same need in a few days since I'm designing some document types with this plugin...
Maybe you can add this information on the plugin wiki page, just for people that choose to use the plugin to know they won't be able to validate any field "wrapped" with a content block.

David

On Thu, Oct 11, 2012 at 10:51 AM, Kenan Salic <[hidden email]> wrote:
Hi Roberto,

It seems the ContentBlocksFieldPlugin isn't validating the compounds (subnodes) like the NodeFieldPlugin is.

What you could do is add a validator on the content block field and validate the compounds yourself until we support this for the ContentBlocksFieldPlugin.

Kenan

On Thu, Oct 11, 2012 at 10:09 AM, Roberto van der Linden <[hidden email]> wrote:
Hello,

We are using the content blocks plugin (1.08.02) and have created several
compounds. Now we have created a custom validator, but this was not
triggered when saving a document. After some research I found out that the
'default' validators like non-empty and required are also not triggered.
(Validators located at
/hippo:configuration/hippo:frontend/cms/cms-validators)

Are we missing some configuration or is it possible that the content blocks
plugin just not uses the validators?

The compounds are also configured in a different namespace.

Thanks in advance,
Roberto



--
View this message in context: http://hippo.2275632.n2.nabble.com/Validators-not-working-in-Content-Block-compound-tp7579505.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US <a href="tel:%2B1%20877%20414%204776" value="+18774144776" target="_blank">+1 877 414 4776 (toll free)
Europe <a href="tel:%2B31%280%2920%20522%204466" value="+31205224466" target="_blank">+31(0)20 522 4466
www.onehippo.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Jeroen Reijn
Administrator
In reply to this post by Kenan Salic
The content blocks is also a public forge plugin. If you have the time
then you could just add it to the plugin. With some reviews and tests
we can release a new version of the content blocks if needed.

On Thu, Oct 11, 2012 at 10:51 AM, Kenan Salic <[hidden email]> wrote:

> Hi Roberto,
>
> It seems the ContentBlocksFieldPlugin isn't validating the compounds
> (subnodes) like the NodeFieldPlugin is.
>
> What you could do is add a validator on the content block field and validate
> the compounds yourself until we support this for the
> ContentBlocksFieldPlugin.
>
> Kenan
>
> On Thu, Oct 11, 2012 at 10:09 AM, Roberto van der Linden <[hidden email]>
> wrote:
>>
>> Hello,
>>
>> We are using the content blocks plugin (1.08.02) and have created several
>> compounds. Now we have created a custom validator, but this was not
>> triggered when saving a document. After some research I found out that the
>> 'default' validators like non-empty and required are also not triggered.
>> (Validators located at
>> /hippo:configuration/hippo:frontend/cms/cms-validators)
>>
>> Are we missing some configuration or is it possible that the content
>> blocks
>> plugin just not uses the validators?
>>
>> The compounds are also configured in a different namespace.
>>
>> Thanks in advance,
>> Roberto
>>
>>
>>
>> --
>> View this message in context:
>> http://hippo.2275632.n2.nabble.com/Validators-not-working-in-Content-Block-compound-tp7579505.html
>> Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
>> _______________________________________________
>> Hippo-cms7-user mailing list and forums
>> http://www.onehippo.org/cms7/support/forums.html
>
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> Boston - 1 Broadway, Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html



--
Jeroen Reijn
Solution Architect
Hippo

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

http://about.me/jeroenreijn
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Roberto van der Linden
As far as I understand, the validators are triggered from the EditingReviewedActionsWorkflowPlugin.

This delegates eventually to the JcrValidationService.validate() where it checks if the fieldType is a node (line 114). Because it is not required and field.getTypeDescriptor().isValidationCascaded() is true, it executes a different validator (JcrTypeValidator) instead of my custom defined validator.

I have thought about adding the property 'hipposysedit:cascadevalidation' on the nodetype, but the type is nt:base.

When I'm able to trigger my custom validator.validate() then its possible to validate the contentblock childnodes.

Or does anyone has another idea where I need to add the validation for the contentblocks?

Cheers,
Roberto


 
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Roberto van der Linden
My previous reply was not entirely correct..

I still want to execute my custom validator, but that requires the fieldType not to be a node... Which is the case :)

So I need a different solution :)

Cheers,
Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Kenan Salic
Hi Roberto,

You can still add the validator on the hipposysedit:field of the content block plugin.

e.g. 

on the hipposysedit:field of cpitems.

In which you have access to the content block (parent) node (in the demo it should be the defaultcontent:cpitem node in stead of the subnodes; defaultcontent:cptext, defaultcontent:cpimage)

Hope this helps.

On Fri, Oct 12, 2012 at 11:29 AM, Roberto van der Linden <[hidden email]> wrote:
My previous reply was not entirely correct..

I still want to execute my custom validator, but that requires the fieldType
not to be a node... Which is the case :)

So I need a different solution :)

Cheers,
Roberto



--
View this message in context: http://hippo.2275632.n2.nabble.com/Validators-not-working-in-Content-Block-compound-tp7579505p7579518.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Roberto van der Linden
Hi Kenan,

Thanks for you answer. I believe that I already had it configured this way. This is the export of my cpitem node (/hippo:namespaces/uva/news/hipposysedit:nodetype/hipposysedit:nodetype/cpitem):

<sv:node sv:name="cpitem" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hipposysedit:field</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:multiple" sv:type="Boolean">
    <sv:value>true</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:ordered" sv:type="Boolean">
    <sv:value>true</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:path" sv:type="String">
    <sv:value>cpitem</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:type" sv:type="String">
    <sv:value>nt:base</sv:value>
  </sv:property>
  <sv:property sv:multiple="true" sv:name="hipposysedit:validators" sv:type="String">
    <sv:value>cp-validator</sv:value>
  </sv:property>
</sv:node>

But it does not reach my custom validate() method as it finds a different type validator. Am I missing your point?

Thanks in advance,
Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Kenan Salic
Hi Roberto,

I remember a fix for the validation mechanisme to support compound types:

It seems this one has been patched on our trunk, unfortunately not in one of our maintenance tags.

You could patch the fix for you project. To try it out.

On Fri, Oct 12, 2012 at 1:30 PM, Roberto van der Linden <[hidden email]> wrote:
Hi Kenan,

Thanks for you answer. I believe that I already had it configured this way.
This is the export of my cpitem node
(/hippo:namespaces/uva/news/hipposysedit:nodetype/hipposysedit:nodetype/cpitem):

<sv:node sv:name="cpitem" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hipposysedit:field</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:multiple" sv:type="Boolean">
    <sv:value>true</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:ordered" sv:type="Boolean">
    <sv:value>true</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:path" sv:type="String">
    <sv:value>cpitem</sv:value>
  </sv:property>
  <sv:property sv:name="hipposysedit:type" sv:type="String">
    <sv:value>nt:base</sv:value>
  </sv:property>
  <sv:property sv:multiple="true" sv:name="hipposysedit:validators"
sv:type="String">
    <sv:value>cp-validator</sv:value>
  </sv:property>
</sv:node>

But it does not reach my custom validate() method as it finds a different
type validator. Am I missing your point?

Thanks in advance,
Roberto




--
View this message in context: http://hippo.2275632.n2.nabble.com/Validators-not-working-in-Content-Block-compound-tp7579505p7579522.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Roberto van der Linden
Hi Kenan,

It works now! Thanks!! :)

Only the thing that is missing is the css class invalid on the content block items, so they are not displayed with a red background...

Do you have any idea where I need to add the class?

Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Kenan Salic
Hi Roberto,

I'm not sure, but is this what you are looking for: https://issues.onehippo.com/browse/CMS7-6246 ?



On Tue, Oct 16, 2012 at 10:30 AM, Roberto van der Linden <[hidden email]> wrote:
Hi Kenan,

It works now! Thanks!! :)

Only the thing that is missing is the css class invalid on the content block
items, so they are not displayed with a red background...

Do you have any idea where I need to add the class?

Roberto



--
View this message in context: http://hippo.2275632.n2.nabble.com/Validators-not-working-in-Content-Block-compound-tp7579505p7579551.html
Sent from the Hippo CMS 7 mailing list archive at Nabble.com.
_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


_______________________________________________
Hippo-cms7-user mailing list and forums
http://www.onehippo.org/cms7/support/forums.html
Reply | Threaded
Open this post in threaded view
|

Re: Validators not working in Content Block compound?

Roberto van der Linden
Hi Kenan,

I don't think that's it. We are working with version 2.22.12 so we already have that version.

Any other tips ;)