[ https://issues.apache.org/jira/browse/WICKET-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876792#action_12876792 ]
robert mcguinness commented on WICKET-1469: ------------------------------------------- I made some modifications for our use case, maybe others would be interested. Renders a required "*" for the labels. public boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) { // make sure any raw markup with wicket:for attrs is a component if (WICKET_FOR_CONTAINER_ID.equals(tag.getId())) { Component wc; if (tag.isOpenClose()) { wc = new WebComponent(WICKET_FOR_CONTAINER_ID + container.getPage().getAutoIndex()); } else { wc = new TransparentContainer(WICKET_FOR_CONTAINER_ID + container.getPage().getAutoIndex()); } String refId = tag.getAttributes().getString(WICKET_FOR_ATTRIBUTE_NAME); if (!Strings.isEmpty(refId)) { refId = refId.trim(); // Find the referred sibling component by id. Component refComponent = container.getParent().get(refId); if (refComponent instanceof FormComponent<?>) { FormComponent<?> formComponent = (FormComponent<?>) refComponent; boolean renderVisible = formComponent.isRenderAllowed() && formComponent.isVisibilityAllowed() && formComponent.isVisible(); if (formComponent.isRequired() && renderVisible) { RequestCycle.get().getResponse().write("<span class=\"required\">*</span>"); } else if (!renderVisible) { markupStream.skipComponent(); return true; } } } container.autoAdd(wc, markupStream); return true; } return false; } > New Wicket tag 'wicket:for' > --------------------------- > > Key: WICKET-1469 > URL: https://issues.apache.org/jira/browse/WICKET-1469 > Project: Wicket > Issue Type: New Feature > Components: wicket > Affects Versions: 1.3.2 > Reporter: Jan Kriesten > Priority: Minor > Fix For: 1.5-M1 > > Attachments: WICKET-1469-for-wicket-1.4.x.patch > > > This often happens during my daily work: > You create a form with labels and corresponding input fields. As it is now, > you have to bind all those Labels and FormComponents together with some > "boilerplate" code within Java. > I'd like to suggest the following enhancement Wicket tag: > <label wicket:for="username" wicket:messge="key">default message</label> > where wicket:for contains the referenced wicket:id -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.