構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Alf Høgemark
Liferay UI taglib : suggestions for input-field tag
2008/09/07 10:44
答え

Alf Høgemark

ランク: Junior Member

投稿: 34

参加年月日: 2008/05/24

最近の投稿

Hi

I have been using the input-field tag in the UI part of the Liferay tag library.

Here are my suggestions to improving the tag, and also some questions as how it is working :

1.
The tag should support datatypes Integer and Double. Currently it supports int and double, but I would like to have support for the non primitive numeric types as well.
Why ? Because I want to be able to support numeric properties that does not have to have a value.

Currently, if i have a int property, the input-field tag will display "0" when the property has no value.
How do people use numeric properties in ServiceBuilder and using the input-field tag ?
Do you use "int" or "Integer" as the type ?

2.
The "fieldParam" property of the input-field does not seem to be working correctly. I assume this property is used to specify what the "fieldname" should be in the HTML generated. If you specify a fieldParam and the type is either String, int or double, the default value will always be displayed. There seems to be a bug in the tag.
To me, it seems like the code should be changed similar to this :
Index: portal-web/docroot/html/taglib/ui/input_field/page.jsp
===================================================================
--- portal-web/docroot/html/taglib/ui/input_field/page.jsp (revision 20078)
+++ portal-web/docroot/html/taglib/ui/input_field/page.jsp (working copy)
@@ -198,6 +198,10 @@

if (fieldParam == null) {
fieldParam = namespace + field;
+ }
+ else {
+ fieldParam = namespace + fieldParam;
+ }

if (type.equals("double")) {
value = String.valueOf(BeanParamUtil.getDouble(bean, request, field, GetterUtil.getDouble(defaultString)));
@@ -214,11 +218,6 @@
value = httpValue;
}
}
- }
- else {
- fieldParam = namespace + fieldParam;
- value = defaultString;
- }

boolean autoEscape = true;

If there is no comments to this, I will raise an issue as support.liferay.com for this.

3.
When the input-field is set up to display an numeric attribute, there does not seem to be any validation of input anywhere. I was expecting the framework to make sure the user only entered a valid numeric value, or displayed an error message if not.
Is there support for validating the input for numeric properties ?

4.
I also think that the "readonly" attribute on standard HTML input tag should be supported by the UI input-field tag.


Regards
Alf Hogemark
Alf Høgemark
RE: Liferay UI taglib : suggestions for input-field tag
2008/09/10 12:22
答え

Alf Høgemark

ランク: Junior Member

投稿: 34

参加年月日: 2008/05/24

最近の投稿

Hi

I just realized that since I'm writing Struts Portlets, I should rather use the struts html tags, instead of the Liferay tag library.
The struts tags have all the functionality I need, and I also think it makes the jsp page code look cleaner and nicer.

Regards
Alf Hogemark
zahra karami
RE: Liferay UI taglib : suggestions for input-field tag
2009/04/08 1:54
答え

zahra karami

ランク: New Member

投稿: 3

参加年月日: 2009/03/10

最近の投稿

Hello Alf
first pardon me for my little english

to add custom validation on input tag in liferay (<liferay-ui:input-field ) ,
you can use of java Script codes , and on submit form you call your java Script function
for example if you want only nummeric format field , use this code :

==============================
in a jsp page in webapps\ROOT\html\portlet\login\
==============================
<script language="javascript">
function isNumeric (text)
{
var ch;
var Numbers = "1234567890";
for (var i=0;i<text.length;i++)
{
ch = Numbers.indexOf(text.charAt(i))
if (ch == -1)
return false;
}
return true;
}
----------------------------------------------------------------------------------------
function checkForm()
{
var MyNumber = document.form.MyFeild;
if(!isNumeric(MyNumber .value) )
{
alert(" Your input is not a number");
return false;
}
return true;
}
</script>
-----------------------------------------------------------------------------------
<form onSubmit="return checkForm();" action="<portlet:actionURL windowState="<%= WindowState.MAXIMIZED.toString() %>" name="form1">

<liferay-ui:input-field model="<%= Contact.class %>" bean="<%= contact2 %>" field="middleName" name="MyFeild" />
------------------------------------------------------------------------------------
I hope this code help you and solve part of your problem
-----------------------------------------------------------------------------------
I use this code but Icould not get the name of the input field . can any body help me?
vikas suresh thakre
How to make liferay-ui:input-field readonly ?
2010/02/21 22:16
答え

vikas suresh thakre

ランク: Junior Member

投稿: 97

参加年月日: 2009/05/18

最近の投稿

Hi All,

is it possible to make <liferay-ui:input-field /> this field readonly.

i get disabled from the tld, it's also solved my purpose but when i try to save that page it can't able to read the text field. For example i had made screen name disabled in the user profile information page and then try to save that page, it is giving me the validation error that "Please enter a valid screen name."

any help here is really appreciable

thanks
Vikas Thakre.
Cesar Gutierrez
RE: How to make liferay-ui:input-field readonly ?
2010/08/18 7:48
答え

Cesar Gutierrez

ランク: New Member

投稿: 5

参加年月日: 2010/08/17

最近の投稿

vikas suresh thakre:
Hi All,

is it possible to make <liferay-ui:input-field /> this field readonly.

i get disabled from the tld, it's also solved my purpose but when i try to save that page it can't able to read the text field. For example i had made screen name disabled in the user profile information page and then try to save that page, it is giving me the validation error that "Please enter a valid screen name."

any help here is really appreciable

thanks
Vikas Thakre.


i have the same problem, u fix it? or anyone else?, thx.
Cesar Gutierrez
RE: How to make liferay-ui:input-field readonly ?
2010/08/18 8:07
答え

Cesar Gutierrez

ランク: New Member

投稿: 5

参加年月日: 2010/08/17

最近の投稿

well searching in liferay forum i got the solution xD, adding a hidden input field solve my problem

1<liferay-ui:input-field model="<%= User.class %>" bean="<%= selUser %>" field="screenName" disabled="<%= true %>"/>
2[b]<input name="<portlet:namespace />screenName" type="hidden" value= <%=selUser.getScreenName() %>" />[/b]
Reinaldo Silva
RE: Liferay UI taglib : suggestions for input-field tag
2010/10/05 21:15
答え

Reinaldo Silva

ランク: New Member

投稿: 3

参加年月日: 2009/12/02

最近の投稿

For <aui:input> Date type fields:

* Allow render without a predefined date to avoid lazy users for critical input.
* Once set, also allow blank / nullify dates for null/non-required date fields.
Mohammed Azam
RE: Liferay UI taglib : suggestions for input-field tag
2010/10/18 23:42
答え

Mohammed Azam

ランク: Regular Member

投稿: 159

参加年月日: 2009/11/06

最近の投稿

Hi,

I used your piece of code in order to understand how to get the value of the inputfield in javascript.
here is the solution--
 1function checkForm(){
 2        var MyNumber = document.getElementById('<portlet:namespace/>middleName');
 3
 4        if(!isNumeric(MyNumber .value) )
 5        {
 6            alert(" please enter a valid phone number");
 7            return false;
 8        }
 9        return true;
10    }

this will serve your purpose.
Ming Wu
RE: How to make liferay-ui:input-field readonly ?
2012/07/17 20:54
答え

Ming Wu

ランク: New Member

投稿: 1

参加年月日: 2012/06/17

最近の投稿

<aui:input name="xxx" label="xxx" readonly="readonly"></aui:input>
Massimiliano Assante
RE: How to make liferay-ui:input-field readonly ?
2013/01/15 7:28
答え

Massimiliano Assante

ランク: Junior Member

投稿: 49

参加年月日: 2010/03/04

最近の投稿

Ming Wu:
<aui:input name="xxx" label="xxx" readonly="readonly"></aui:input>


this does not work (liferay 6.0.6 CE)
Umer Sayeed
RE: How to make liferay-ui:input-field readonly ?
2013/03/07 2:30
答え

Umer Sayeed

ランク: Junior Member

投稿: 51

参加年月日: 2012/08/08

最近の投稿

$(document).ready(function(){
document.getElementById('name').readOnly=true
});

<tr><td>Name<b style="color: red;">*</b></td><td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td> <aui:input label="" name="name" /></td></tr>
Jorge García
RE: How to make liferay-ui:input-field readonly ?
2013/08/07 1:10
答え

Jorge García

ランク: New Member

投稿: 12

参加年月日: 2012/05/11

最近の投稿

Have you tried the disabled property?

<liferay:ui-input name="name" label="label" disabled="true"/>