Given a dojo input widget (any form widget), what’s the best way to obtain the widget’s form element? i.e. parent element.
i.e. I am looking to complete a function like this:
function getForm(widget) {
return ( /**code goes here **/);
}
Thanks
Since form widgets can also be used outside forms, the only way I can think of is the same as you would do without widgets: get a starting dom node and move up until you get to a form node:
(I havent tested this yet though)
By the way, why do you need to do this? Most of the times you can put most of the logic in the form itself (it can also be a dijit.form.Form if you want) and the input widgets don’t need to know anything about it.