掲示板
styling from a hook in a new registration portlet with custom-attributes
12年前 に Tibor Kiss によって更新されました。
styling from a hook in a new registration portlet with custom-attributes
Junior Member 投稿: 52 参加年月日: 07/01/29 最新の投稿
I have created a hook from html/portlet/login/create_account.jsp.
There I added two custom fields and in addition I moved every field into a single aui:column.
There are styling problem with the fields. For example the Email Address width is too small and the newly added custom attributes width are larger than the aui-column so that the newly added input fields are not fit in the space.
I tried several css style elements to modifiy in order to have fixed these issues, but none of them seems to work.
Could you point me to an example where aui-fieldset, aui:column based forms are styled so that the width can be enlarged and all of its fields are streched to that lenght?
Or just the custom-attribute's field to get fixed.
There I added two custom fields and in addition I moved every field into a single aui:column.
There are styling problem with the fields. For example the Email Address width is too small and the newly added custom attributes width are larger than the aui-column so that the newly added input fields are not fit in the space.
I tried several css style elements to modifiy in order to have fixed these issues, but none of them seems to work.
Could you point me to an example where aui-fieldset, aui:column based forms are styled so that the width can be enlarged and all of its fields are streched to that lenght?
Or just the custom-attribute's field to get fixed.
12年前 に Tibor Kiss によって更新されました。
RE: styling from a hook in a new registration portlet with custom-attribute
Junior Member 投稿: 52 参加年月日: 07/01/29 最新の投稿
The problem of validation for newly added custom attributes I solved with a hook
and the struts action
The custom-attribute input cell widths I configured from the Control Panel, where the attributes was created, by setting the number of pixels to width param.
What I couldn't solve, is the highlighting of the custom-attribute fields when validation failed on them.
Frankly to say I didn't find any use case for RequiredFieldException... whose constructor has two params, but I don't see if the validation errors are working with it.
The aui:input fields has correct error handling highlights but the liferay-ui:custom-attribute does not have that possibility.
<hook>
<portal-properties>portal.properties</portal-properties>
<language-properties>Language_en_US.properties</language-properties>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
<struts-action>
<struts-action-path>/login/create_account</struts-action-path>
<struts-action-impl>org.myapp.hook.action.RegistrationStrutsPortletAction</struts-action-impl>
</struts-action>
</hook>
and the struts action
public class RegistrationStrutsPortletAction extends BaseStrutsPortletAction {
private boolean validate(final ActionRequest actionRequest,
final Map<string, serializable> expandoBridgeAttributes,
final String attributeName, final String attributeLabel) {
String userAddress = (String)expandoBridgeAttributes.get(attributeName);
boolean valid = true;
if (Validator.isNull(userAddress)) {
RequiredFieldException e = new RequiredFieldException(attributeName, attributeLabel); // v6.0/EE specific code
SessionErrors.add(actionRequest, e.getClass().getName(), e);
valid = false;
}
return valid;
}
@Override
public void processAction(
StrutsPortletAction originalStrutsPortletAction,
PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
Company company = themeDisplay.getCompany();
Map<string, serializable> expandoBridgeAttributes =
PortalUtil.getExpandoBridgeAttributes(
ExpandoBridgeFactoryUtil.getExpandoBridge(
company.getCompanyId(), User.class.getName()), actionRequest);
boolean valid = validate(actionRequest, expandoBridgeAttributes, "my-first-attribute", "my-first-attributeLabel");
valid = valid && validate(actionRequest, expandoBridgeAttributes, "my-second-attribute", "my-second-attributeLabel");
if (!valid) {
return;
}
originalStrutsPortletAction.processAction(
portletConfig, actionRequest, actionResponse);
}
@Override
public String render(
StrutsPortletAction originalStrutsPortletAction,
PortletConfig portletConfig, RenderRequest renderRequest,
RenderResponse renderResponse)
throws Exception {
return originalStrutsPortletAction.render(
portletConfig, renderRequest, renderResponse);
}
@Override
public void serveResource(
StrutsPortletAction originalStrutsPortletAction,
PortletConfig portletConfig, ResourceRequest resourceRequest,
ResourceResponse resourceResponse)
throws Exception {
originalStrutsPortletAction.serveResource(
portletConfig, resourceRequest, resourceResponse);
}
}</string,></string,>
The custom-attribute input cell widths I configured from the Control Panel, where the attributes was created, by setting the number of pixels to width param.
What I couldn't solve, is the highlighting of the custom-attribute fields when validation failed on them.
Frankly to say I didn't find any use case for RequiredFieldException... whose constructor has two params, but I don't see if the validation errors are working with it.
The aui:input fields has correct error handling highlights but the liferay-ui:custom-attribute does not have that possibility.
12年前 に David H Nebinger によって更新されました。
RE: styling from a hook in a new registration portlet with custom-attribute
Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
You should be using the theme for your styling changes.