Problem solved.

I had both <wicket:head> and <head> sections in my html and the FormModificationDetectorBehavior was being attached twice. This was causing a "too many recursions" error in the javascript and the code was dying. Pulling out the <head> tag and placing everything within <wicket:head> cured it.

It's working again.

Kurt Heston wrote:
The problem appears to be related to the code I used to replace the old onAttach code. It was:

////////////////////
    protected void onAttach() {
      super.onAttach();
          if (firstTimeThru) {
final WebMarkupContainer c = this.getBodyContainer().getBodyContainer();
        c.add(new SimpleAttributeModifier("onload",
        "FORMCONFIRM=true;FORMISDIRTY=false;"));
        c.add(new SimpleAttributeModifier("class", "body1"));
        c.add(new SimpleAttributeModifier("onbeforeunload",
"return warnOnPageExit('Data has changed. Make sure you press save "
        + "if you want to keep your changes!');"));
        firstTimeThru = false;
      }
    }
////////////////////

now it is:

////////////////////
 public void renderHead(IHeaderResponse arg0) {

   if (firstTimeThru) {
     arg0.renderOnLoadJavascript("FORMCONFIRM=true;FORMISDIRTY=false;");
     arg0.renderCSSReference("body1");
     arg0.renderOnEventJavacript("window", "onbeforeunload",
"return warnOnPageExit('Data has changed. Make sure you press save "
             + "if you want to keep your changes!');");
     firstTimeThru = false;
   }
 }

////////////////////

I'm focusing on tweaking this at the moment. Not sure yet what's going on.

Kurt Heston wrote:
Not yet. Still trying to figure it out. Just wanted to make sure I wasn't overlooking something in the manual that works just as as well or better.

Igor Vaynberg wrote:
do you know why it doesnt work?

-igor

On Sat, Mar 7, 2009 at 12:26 PM, Kurt Heston <[email protected]> wrote:
I haven't been able to make this work since my upgrade from 1.2.x to 1.3.5:

http://javathoughts.capesugarbird.com/2007/11/warning-on-page-exit-for-wicket-12x.html


It was pretty slick.  I was able to warn the user that she/he had
changed a field without saving when trying to navigate away. Is there a
better facility in 1.3.x that I can use for the same purpose?


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to