Foren

Validation on Length of Page Name in liferay 6.1

Neha Singh, geändert vor 12 Jahren.

Validation on Length of Page Name in liferay 6.1

New Member Beiträge: 4 Beitrittsdatum: 02.04.12 Neueste Beiträge
My requirement is to restrict the Page name size in liferay 6.1. For this, I am developing hook but I am unable to find the file which has to be overridden.
Am unable to find the jsp that has input tag for "Page Name".
thumbnail
Pankaj Kathiriya, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Liferay Master Beiträge: 722 Beitrittsdatum: 05.08.10 Neueste Beiträge
Hi Neha,

You can override \html\portlet\layouts_admin\layout\details.jsp for your changes.


HTH,
Regards,
Pankaj
Liferay Developer
Neha Singh, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

New Member Beiträge: 4 Beitrittsdatum: 02.04.12 Neueste Beiträge
Hi Pankaj,
I tried looking into that jsp "details.jsp" but couldnt find the
input tag which has to be customized to restrict the Page Name size.
Can you please help me with that or provide some snippets for the same.
thumbnail
Pankaj Kathiriya, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Liferay Master Beiträge: 722 Beitrittsdatum: 05.08.10 Neueste Beiträge
Hi Neha,

<aui:input name="name" />
is the tag in details.jsp which will be Layout/Page name.
You can have some js code on it.


Thanks,
Pankaj
thumbnail
Tejas Kanani, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Liferay Master Beiträge: 654 Beitrittsdatum: 06.01.09 Neueste Beiträge
Just to add more what Pankaj has suggested.
You can call below javascript function to validate length limit. I've not tried it but it should work.

<aui:input name="name" onkeyup="ismaxlength(this);" />



function ismaxlength(obj){
	var mlength=50;
	if (obj.getAttribute &amp;&amp; obj.value.length&gt;mlength)
	{
		obj.value=obj.value.substring(0,mlength)
	}
}


HTH.
Sandip Kutwal, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

New Member Beiträge: 3 Beitrittsdatum: 05.04.12 Neueste Beiträge
Hi Neha,
Please try below code. It will work emoticon

<aui:input name="name">
<aui:validator name="maxLength">
</aui:validator>
</aui:input>
Neha Singh, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

New Member Beiträge: 4 Beitrittsdatum: 02.04.12 Neueste Beiträge
Hi Sandip,
Thanx for the reply.. That seems to work fine.Solved my issue emoticon Here's the snippet which i used

<aui:input name="name" >
<aui:validator name="required" />
<aui:validator name="rangeLength">
[1,10]
</aui:validator>
</aui:input>

But can you please thow light on why the changes made in one Add Page jsp didn't reflect on other Add Page jsp's like from
control panel when we add a page or when we add a page from Dockbar. Does it use different jsp's for doin the same work?
thumbnail
Praveen P, geändert vor 11 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Regular Member Beiträge: 100 Beitrittsdatum: 21.02.12 Neueste Beiträge
Hi all if i want to use exact number of characters, lets say 5, if input has to take exact 5 characters then how to validate? or how to use validator tag?

Thanks in advance
Praveen
thumbnail
Praveen P, geändert vor 11 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Regular Member Beiträge: 100 Beitrittsdatum: 21.02.12 Neueste Beiträge
i got emoticon its working fine with
<aui:validator name="rangeLength">[5,5]</aui:validator>
if u want to fix exact number of characters for input then you can use this tag

Thanks and regards
Praveen
thumbnail
Richard SINELLE, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Junior Member Beiträge: 28 Beitrittsdatum: 07.04.11 Neueste Beiträge
Hi

The other way to customize the length page name is to extended the model-hints of Page object

See : http://www.liferay.com/community/wiki/-/wiki/Main/Customize+DB+Column+Sizes

Richard
thumbnail
David H Nebinger, geändert vor 12 Jahren.

RE: Validation on Length of Page Name in liferay 6.1

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Richard SINELLE:
The other way to customize the length page name is to extended the model-hints of Page object


First, you would never want to do this on the Liferay services because it would impede your ability to do updates in the future.

Second, just because the column size is changed in model hints, it does not mean that would get pushed to the database, to the code, etc.

In fact, doing this sort of thing is going to lead you down the wrong rabbit hole...