掲示板

How to disable functionality of creating pages with duplicate name

thumbnail
8年前 に Vatsal Upadhyaya によって更新されました。

How to disable functionality of creating pages with duplicate name

New Member 投稿: 10 参加年月日: 15/10/20 最新の投稿
How can I disable creation of pages with duplicate names , i.e. If a page with name "Test" exists in that case user cannot add another page with same name. Site should give some type of warning.

TIA.
thumbnail
8年前 に Andrew Jardine によって更新されました。

RE: How to disable functionality of creating pages with duplicate name

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Hi Vatsal,

The page names don't need to be unique in Liferay, only the friendly URLs do. You'll find that if you try to create two pages, even if they have different names, with the same friendly URL then you will get an error (provided this test is done within the context of a single site).

There are a few ways you can add this prevention mechanism if you want.

1. You could create a JSP hook for the Site Management page and onblur for the field make an ajax call to validate that the name is unique.

2. You could use a StrutsActionHook to override the EditLayoutAction (I think that is the one anyway, I haven't checked) and do the check server side.

3. You could use a model listener with an onBeforeCreate to do the check.

-- of the three, I would say that #2 feels like the cleanest to me to be honest. Either way I don't think there is a setting or property that you can toggle to force this.
thumbnail
7年前 に Vatsal Upadhyaya によって更新されました。

RE: How to disable functionality of creating pages with duplicate name

New Member 投稿: 10 参加年月日: 15/10/20 最新の投稿
Thanks Andrew.