掲示板

Required custom fields

thumbnail
9年前 に Michele Zanarotti によって更新されました。

Required custom fields

Junior Member 投稿: 94 参加年月日: 12/02/20 最新の投稿
How to set a custom fields as required ?

When editing the custom field I have so many options except the 'required' attribute.

Do I have to create a custom Action with a hook ?
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: Required custom fields

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Required is not really an aspect of the custom field, it is an aspect of the interface where you want the user(s) to enter or choose a value.

To that end you have to code in the enforcement of 'required'.
thumbnail
9年前 に Michele Zanarotti によって更新されました。

RE: Required custom fields

Junior Member 投稿: 94 参加年月日: 12/02/20 最新の投稿
Hello.

I'm striving to get this simple work done with <liferay-ui:custom-attribute> tag.
But it seems to have many restriction so I can't find a way to render this tag with a required attribute. I can't even set a custom label.

I know I should probably go with aui:input or hidden fields, but this forces me to traverse the entire custom field to render it properly based on its nature.

Server side I have no problem in managing that, but people doesn't understand it's required the first time they visit the form.
thumbnail
9年前 に Tina Agrawal によって更新されました。

RE: Required custom fields

Expert 投稿: 297 参加年月日: 08/01/03 最新の投稿
You can try one thing. Try writing a JS validation for the same.
You can also display some * before the field using html before you use the tag library.

Tina
8年前 に Hassan Bakri によって更新されました。

RE: Required custom fields

New Member 投稿: 4 参加年月日: 15/06/18 最新の投稿
i think this will help
http://www.liferaysavvy.com/2014/01/objective-perform-form-validation-in.html

to get ( build ) custom field name : _portletId_ExpandoAttribute--custom field name--

i have custom field on user model it's name National-Number so to get the name (fieldName) on creat account form (it's id == 58) would be like this

_58_ExpandoAttribute--National-Number--