留言板

aui validation ?

thumbnail
angu manikandan,修改在10 年前。

aui validation ?

Junior Member 帖子: 72 加入日期: 12-7-16 最近的帖子
HI,
In aui input field user cant able to type more than six characters?How to give that kind of fixed numbers of caharacters in aui....
Thanks in advance..
thumbnail
Ahmed Hasan,修改在10 年前。

RE: aui validation ?

Expert 帖子: 306 加入日期: 07-4-13 最近的帖子
Hi Angu,

I have dedicated on section exclusively on AUI validation in my FREE eBook on Liferay Portlet Development. You can download a free copy and refer to chapter no. 4 to know about this in details. Please revert back to me if you still have questions.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
thumbnail
angu manikandan,修改在10 年前。

RE: aui validation ?

Junior Member 帖子: 72 加入日期: 12-7-16 最近的帖子
To-->Ahamed Hasan:
In that book i saw Form validation but from my Requirements i didnt get my answer sir !...
thumbnail
Atin Agarwal,修改在10 年前。

RE: aui validation ?

Junior Member 帖子: 86 加入日期: 12-2-20 最近的帖子
Hi Angu,

You can try this -

<aui:input name="name" type="text" onBlur="validateName()"/>

<aui:script>
function validateName() {
AUI().use(function(A) {
var name = A.one("#<portlet:namespace/>name").val();
if(name.length > 6) {
alert("Length Exceeded");
}
});
}
</aui:script>

Regards,
Atin Agarwal
thumbnail
angu manikandan,修改在10 年前。

RE: aui validation ?

Junior Member 帖子: 72 加入日期: 12-7-16 最近的帖子
Hi Atin Agarwal,
My aui input field is not text field That is Pincode field only digits can only enter...
thumbnail
Atin Agarwal,修改在10 年前。

RE: aui validation ?

Junior Member 帖子: 86 加入日期: 12-2-20 最近的帖子
Use this -

<aui:input name="name" type="text" onBlur="validateName()">
<aui:validator name="digits" />

</aui:input>
thumbnail
angu manikandan,修改在10 年前。

RE: aui validation ?

Junior Member 帖子: 72 加入日期: 12-7-16 最近的帖子
For me user can't able to type more than Six characters (in numbers) this my requirement.
thumbnail
Atin Agarwal,修改在10 年前。

RE: aui validation ?

Junior Member 帖子: 86 加入日期: 12-2-20 最近的帖子
Yes i understand that.
First validation i.e. <aui:validator name="digits" /> will take care of the fact that user can only enter digits.
Second custom validation(through script) will take care of the fact that user can cannot enter more than 6 characters.

Use this and let me know in case of any issues.

Regards,
Atin Agarwal