开发者

Magnolia CMS: Duplicate data validation in spring blossom paragraph

I have a paragraph defined in spring blossom which cons开发者_运维技巧ists of edit,file, select and date controls. Now I want to allow only one data entry for each date in that page, i.e. date field should be unique. How can I do duplicate data validation based on date field in DailogValidator?

Thanks, Rupali


In the validator you have access to the content and can iterate through it looking for a paragraph having the same date.

You can get the content either from MgnlContext.getAggregationState() or by adding DialogCreationContext as an argument to your validator method.

When iterating the content of the page you should be looking at nodes of type ContentNode having the same paragraph. The paragraph assigned to the node is set in the nodes MetaData as 'template'.

This code does basically the same thing but you might want to change it from searching by class to searching for name instead.

Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜