Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
shubhranshu swain
Custom field value
8 de Novembro de 2011 01:02

shubhranshu swain

Ranking: New Member

Mensagens: 18

Data de entrada: 18 de Janeiro de 2011

Mensagens recentes

Hi All

I have created a custom field telephone. I want to get the value before the page is submitted(not from the expando table).

Pls help

Rajesh Chaurasia
RE: Custom field value
15 de Novembro de 2011 22:47

Rajesh Chaurasia

Ranking: Regular Member

Mensagens: 129

Data de entrada: 18 de Agosto de 2011

Mensagens recentes

You can do what you asked by first fetching the custom field value on page load and then set it to some hidden field.On submit you will have that value in backend.

Step 1: Get value from Expando Column table:

Integer webCntMaxSize = 0;
long jrnlClassNameId = ClassNameLocalServiceUtil.getClassNameId(JournalArticle.class.getName());
long company_id = user.getCompanyId();
ExpandoTable jnrnlTable = ExpandoTableLocalServiceUtil.getDefaultTable(company_id, jrnlClassNameId);
ExpandoColumn jrnlColumn = ExpandoColumnLocalServiceUtil.getColumn(jnrnlTable.getTableId(), "mxWebContentSize");
String value = jrnlColumn.getDefaultData();
System.out.println("value in server.jspf:"+value);
if (value != null) {
webCntMaxSize= Integer.parseInt(value);

Step 2:Set the value in hidden field as below:

<aui:form method="post" name="fm2">
<input name="fieldName" type="hidden" value="<%=value%>" />

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!