added example passing text field to constructor