フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Sujay Kumar Paul
Field validation
2013/01/20 23:03
答え

Sujay Kumar Paul

ランク: Regular Member

投稿: 165

参加年月日: 2011/10/28

最近の投稿

Hi,

In create account page if i skip the first name then it will give an error message "First Name Required " .

Is it possible to do this type of validation for custom field ?

Please help.

Subhash Pavuskar
RE: Field validation
2013/01/21 6:16
答え

Subhash Pavuskar

ランク: Regular Member

投稿: 234

参加年月日: 2012/03/12

最近の投稿

You can do this validation by JavaScript here is an example Click here
Sujay Kumar Paul
RE: Field validation
2013/01/21 22:45
答え

Sujay Kumar Paul

ランク: Regular Member

投稿: 165

参加年月日: 2011/10/28

最近の投稿

Thanks Subhash

But i have add this code for custom fields

<liferay-ui:custom-attribute
className="com.liferay.portal.model.User"
classPK="<%= 0l %>"
editable="<%= true %>"
label="<%= true %>"
name="Phone No"
/>

where & how should i add the js

thanks in advance.
Subhash Pavuskar
RE: Field validation
2013/01/21 22:57
答え

Subhash Pavuskar

ランク: Regular Member

投稿: 234

参加年月日: 2012/03/12

最近の投稿

Hi,

One of the clean ways to include js file in a portlet, independent of the portal server is to configure in
portlet deployment descriptor file as below i.e liferay-portlet.xml.

1<portlet>
2    <portlet-name>MySamplePortlet</portlet-name>
3    <header-portlet-javascript> </header-portlet-javascript>
4</portlet>
Sujay Kumar Paul
RE: Field validation
2013/01/22 5:02
答え

Sujay Kumar Paul

ランク: Regular Member

投稿: 165

参加年月日: 2011/10/28

最近の投稿

<liferay-ui:custom-attribute onclick="validate()"
className="com.liferay.portal.model.User"
classPK="<%= 0l %>"
editable="<%= true %>"
label="<%= true %>"
name="Phone No"
/>

its not working
Akram MONCER
RE: Field validation
2013/01/22 12:00
答え

Akram MONCER

ランク: Regular Member

投稿: 106

参加年月日: 2012/09/25

最近の投稿

look at this blog i think it can help : http://drewblessing.com/blog/-/blogs/34509
Sujay Kumar Paul
RE: Field validation
2013/01/25 3:38
答え

Sujay Kumar Paul

ランク: Regular Member

投稿: 165

参加年月日: 2011/10/28

最近の投稿

Thanks Akram
This <aui:validator> is applicable for <aui:input>.
I need validator for <liferay-ui:custom-attribute>
Apoorva Prakash
RE: Field validation
2013/01/25 6:52
答え

Apoorva Prakash

ランク: Liferay Master

投稿: 659

参加年月日: 2010/06/15

最近の投稿

sujay paul:
Thanks Akram
This <aui:validator> is applicable for <aui:input>.
I need validator for <liferay-ui:custom-attribute>

Hello Sujay,

Hope this will help...

 1<aui:script use="liferay-form">
 2        Liferay.Form.register(
 3            {
 4                id: '<portlet:namespace />fm',
 5                fieldRules: [
 6                    {
 7                        body: '',
 8                        custom: false,
 9                        errorMessage: 'Please enter the company name.',
10                        fieldName: '<portlet:namespace />ExpandoAttributeName',
11                        validatorName: 'required'
12                    }
13                ]
14            }
15        );
16    </aui:script>


Thanks and Regards,
Apoorva Prakash