Sorry I can't help you with your question.  But may I ask where you get the
PhoneFormatter?

On Wed, May 14, 2008 at 5:58 PM, 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

Reply via email to