Sam, a similar issue happened to the WicketAjaxIndicatorAppender. take a look at WicketAjaxIndicatorAppender#renderHead to see how this is solved there. maybe you can do something similar with your RequiredBorder.
regards, Gerolf On Thu, May 15, 2008 at 2:58 AM, Sam Barnum <[EMAIL PROTECTED]> wrote: > Using the tips in this PDF > http://londonwicket.org/content/LondonWicket-FormsWithFlair.pdf > > I created the simple RequiredBorder class as follows: > > public class RequiredBorder extends MarkupComponentBorder { > public void renderAfter(Component component) { > FormComponent fc = (FormComponent) component; > if (fc.isRequired()) { > super.renderAfter(component); > } > } > } > > This basically adds a "*" after any required fields. It seemed to work > great until I used it with an ajax phone formatter behavior: > > new AjaxFormComponentUpdatingBehavior("onchange") { > protected void onUpdate(AjaxRequestTarget target) { > Object oldValue = component.getValue(); > String formatted = new PhoneFormatter().format(oldValue); > component.setModelObject(formatted); > target.addComponent(component); > } > } > > > This caused duplicate "*" indicators to appear after my phone field when > the phone number changed, one per onchange request. I tried adding a > boolean field to the RequiredBorder so it only gets processed once. This > fixed the phone formatter duplicates, but if the form submits and stays on > the same page, all the "*" marks disappear from the required fields. > > This is definitely some sort of lifecycle problem, but how do you fix it? > > On a related note, is it generally a bad idea to mix AJAX and non-ajax > actions? It seems like this is one of many issues I've run into when doing > this. > > Thanks, > > -Sam Barnum