Form with CustomField

Hello all,

I am very new to Vaadin and am currently evaluating it. I have created a CustomField component using the CustomField extension and when I create the component on the form I pass an event handler object to it which implements the Button.ClickListener interface. The custom field is a search field with a button that triggers the filling of several form fields. However, for the life of me, I cannot figure out how to get a handle back to the form from the CustomField component. I know I can keep iterating back through the parents but I want to make the implementation as generic as possible.

What am I missing here? Keep in mind, I am very new to the framework and maybe what I am doing is completely backwards anyway. Basically, I am working on a vehicle registration screen and want the user to enter a serial number and then I go and look up the details of that serial number for our backend system. That is the jist of it.

I have attached a screenshot below of what I have done thus far.

Any input would be seriously appreciated!

Thanks.
Curtis
11608.jpg

The easiest solution is to pass outside Form instance to CustomField constructor and save it in some field :wink: Am I right?

Thanks, guess I was trying to make this more difficult that it needed to be.

Curtis

Yes, the FieldFactory you are using is probably specific to the form anyway so I would pass a reference to the Form in it - either as a Form or some subclass of Form or interface that gives you a more convenient API for filling the fields you are interested in.