Hi all,

I've developed a custom FormComponent (by subclassing FormComponentPanel) to act as a reference from one object to another (eg a Customer to an Address), but am having problems figuring out how to handle clear input (ie, if the user hits the cancel button on the form).

To explain a little further, the FormComponent is called EntityLink, and renders the reference (eg the Customer's homeAddress) a hyperlink. I have a button on the EntityLink panel allowing the user to perform a search for other objects of the correct type, and then select it. Doing this updates the EntityLink component, with a "pending" value (ie of the new homeAddress). If the user hits the OK button, then the pending value is copied over to the domain object (ie to the Customer's actual homeAddress property).

In the cancel button's onSubmit() method I'm calling getForm().clearInput(), which seems to use a visitor to call clearInput() on all child FormComponent's. The FormComponent's clearInput() method seems only to set the rawInput to a constant (NO_RAW_INPUT), which looks like it's a magic value of some kind when the form component is actually rendered - all rather low level.

I think what I'd like is to eagerly capture this clearInput so that I can reset my EntityLink's hyperlink back to the original value and discard the pending value. However, clearInput() is unfortunately marked as final so there doesn't seem to be any easy way to capture this.

Looking at other implementations of FormComponentPanel (eg DateTimeField) they are really very little other than wrappers around simple FormComponents, so they don't offer any real clues.

Can anyone help me here, then?

Thanks
Dan


--
Dan Haywood
consultant, mentor, developer, author
agile, ddd, oo, java, .net, sybase
MA, MBCS, CITP, CEng
/mail: /d...@haywood-associates.co.uk <mailto:d...@haywood-associates.co.uk>
/phone: /+44 (0)7961 144286
/book: /Domain Driven Design using Naked Objects <http://pragprog.com/titles/dhnako>
/blog: /http://danhaywood.com
/linked in: /http://uk.linkedin.com/in/dkhaywood
/twitter: /http://twitter.com/dkhaywood
/sybase: /http://sybtraining.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to