Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: DXP 7.1- Form- Introducing a new field to capture logged in users detai
Hi,
I am using DXP 7.1. Any idea on how i can have a field that will populate logged in user's details; like username?
Thanks
Gopal
I am using DXP 7.1. Any idea on how i can have a field that will populate logged in user's details; like username?
Thanks
Gopal
Hi Gopal,
Login with admin>>>contral panel>>>> configuration>>>>Custom Fields>>>>user>> right side + buttan Click
you can create........
Thank you
Ram
Login with admin>>>contral panel>>>> configuration>>>>Custom Fields>>>>user>> right side + buttan Click
you can create........
Thank you
Ram
Ramalingaiah. DHello Ramalingaiah,
Hi Gopal,
Login with admin>>>contral panel>>>> configuration>>>>Custom Fields>>>>user>> right side + buttan Click
you can create........
Thank you
Ram
I think you got it wrong. My intension is not to create custom fields for User, but in "DXP 7.1 Liferay Form" i need to have a form field which can automatically show logged in user's details when it is added to the form.
Thanks,
Gopal
Hi Gopal ,
you can add jsp
<%@ page import="com.liferay.portal.kernel.model.User"%>
User Name::<%User userU = themeDisplay.getUser();%><%=userU.getFullName()%>
Email Id:<%=user.getEmailAddress()%>
Thank you
Ram
you can add jsp
<%@ page import="com.liferay.portal.kernel.model.User"%>
User Name::<%User userU = themeDisplay.getUser();%><%=userU.getFullName()%>
Email Id:<%=user.getEmailAddress()%>
Thank you
Ram
Ramalingaiah. DHi Gopal ,
you can add jsp
<%@ page import="com.liferay.portal.kernel.model.User"%>
User Name::<%User userU = themeDisplay.getUser();%><%=userU.getFullName()%>
Email Id:<%=user.getEmailAddress()%>
Thank you
Ram
Hello Ramalingaiah,
My question is specific to "Liferay Forms" which comes with DXP 7.1. I need to know which extension point to use or if i need to create a custom field. Your suggestion is a generic one which i am aware of.
Thanks
Gopal
Andrew JardineDid you try this?Hello Andrew,
https://dev.liferay.com/en/develop/tutorials/-/knowledge_base/7-1/form-field-types
Thanks for the reply.
Yes i have been looking to the link you have provided. i am able to create a field, but am bit confused on where to write the code to set the value of that field.In mycase i will fetch the logged in user's say userid/emailaddress. Could you please advise?
Thanks
Gopal
Hi Gopal,
I think yo uare supposed to use the predefined value from the FormFiteldType. I'm looking at the Liferay source and I can see that the *DDMFormFieldTemplateContextContributor adds this predefined value the parameter map
I think yo uare supposed to use the predefined value from the FormFiteldType. I'm looking at the Liferay source and I can see that the *DDMFormFieldTemplateContextContributor adds this predefined value the parameter map
@Override
public Map<string, object> getParameters(
DDMFormField ddmFormField,
DDMFormFieldRenderingContext ddmFormFieldRenderingContext) {
Map<string, object> parameters = new HashMap<>();
parameters.put(
"predefinedValue",
GetterUtil.getString(ddmFormField.getPredefinedValue(), ""));
String predefinedValue = getPredefinedValue(
ddmFormField, ddmFormFieldRenderingContext);
if (predefinedValue != null) {
parameters.put("predefinedValue", predefinedValue);
}
return parameters;
}
protected String getPredefinedValue(
DDMFormField ddmFormField,
DDMFormFieldRenderingContext ddmFormFieldRenderingContext) {
LocalizedValue predefinedValue = ddmFormField.getPredefinedValue();
if (predefinedValue == null) {
return null;
}
return predefinedValue.getString(
ddmFormFieldRenderingContext.getLocale());
}
</string,></string,>
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™