掲示板

Field validation

thumbnail
11年前 に sujay paul によって更新されました。

Field validation

Regular Member 投稿: 164 参加年月日: 11/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.

thumbnail
11年前 に Subhash Pavuskar によって更新されました。

RE: Field validation

Regular Member 投稿: 234 参加年月日: 12/03/13 最新の投稿
You can do this validation by JavaScript here is an example Click here
thumbnail
11年前 に sujay paul によって更新されました。

RE: Field validation

Regular Member 投稿: 164 参加年月日: 11/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.
thumbnail
11年前 に Subhash Pavuskar によって更新されました。

RE: Field validation

Regular Member 投稿: 234 参加年月日: 12/03/13 最新の投稿
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.

<portlet>
    <portlet-name>MySamplePortlet</portlet-name>
    <header-portlet-javascript> </header-portlet-javascript>
</portlet>
thumbnail
11年前 に sujay paul によって更新されました。

RE: Field validation

Regular Member 投稿: 164 参加年月日: 11/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
11年前 に Akram MONCER によって更新されました。

RE: Field validation

Regular Member 投稿: 106 参加年月日: 12/09/25 最新の投稿
look at this blog i think it can help : http://drewblessing.com/blog/-/blogs/34509
thumbnail
11年前 に sujay paul によって更新されました。

RE: Field validation

Regular Member 投稿: 164 参加年月日: 11/10/28 最新の投稿
Thanks Akram
This <aui:validator> is applicable for <aui:input>.
I need validator for <liferay-ui:custom-attribute>
thumbnail
11年前 に Apoorva Prakash によって更新されました。

RE: Field validation

Liferay Master 投稿: 658 参加年月日: 10/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...

<aui:script use="liferay-form">
        Liferay.Form.register(
            {
                id: '<portlet:namespace />fm',
                fieldRules: [
                    {
                        body: '',
                        custom: false,
                        errorMessage: 'Please enter the company name.',
                        fieldName: '<portlet:namespace />ExpandoAttributeName',
                        validatorName: 'required'
                    }
                ]
            }
        );
    </aui:script>


Thanks and Regards,
Apoorva Prakash