I think I would do kind of the same if I understand you correctly. An attribute modifier could do find(Form.class) on the component it is attached to, and then figure out the components it should include in the check. I would make a separate Javascript function in a separate file that would be included in the header, and call that function from the attribute modifier(s).
I would avoid any roundtrips. You could create a var for each field that should be checked, and initialize those vars via another, dynamic header contribution. Just make sure they are scoped properly, and that you do that only once, even if you have multiple instances of that check in place. Those vars can then be used for comparison with the current field values in the first function. Eelco > I am trying to implement a mechanism where a confirmation dialogue is raised > if the user leaves a form either via the cancel button, or selecting to > navigate to another page. I only want this dialogue to appear if the model > has changed so that the user knows that they have changed the data but not > saved it. The dialogue will allow the user to select 'yes' to navigate to > their next page or 'no' to stay on the current page. > > Has anyone implemented something similar or have an idea how it can be done. > > > > The idea I have had is to intercept the onChange event on all the controls > changing the forms model. This would switch the buttons to versions which > contain a SimpleAttributeModifier which adds the JavaScript confirm dialogue > on the onClick event. This all seems very messy so any simpler solutions > would be gratefully received. > > > > Thanks in advance, > > > > Jeremy > > This email and any files transmitted with it are confidential, proprietary > and intended solely for the individual or entity to whom they are addressed. > If you have received this email in error please delete it immediately. > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user