Opened 12 years ago

Closed 12 years ago

#5206 closed defect (duplicate)

form widgets do not carry over form attribute

Reported by: tk Owned by:
Priority: high Milestone: 1.1
Component: Dijit Version: 1.0
Keywords: dijit.form.* form Cc:
Blocked By: Blocking:

Description

Native input/form nodes (input/select etc) all have a .form reference that goes back to its parent form... currently dijit.form.* does not follow this...

Change History (5)

comment:1 Changed 12 years ago by bill

Milestone: 1.0.21.1

Hmm, a FormWidget?.form attribute (rather than a FormWidget?.getForm() method) would slow down instantiation slightly. Since the original source node might be a <div> rather than an <input> we can't copy the form attribute from the source node but rather have to compute it.

Also problematic because maybe there is no source node at all, like in var foo = new dijit.form.Button() , so there's no way to compute what form is, until foo is inserted into the DOM tree, and we don't know when that happens.

Finally, if the dom node is moved from one form to another then we would have a stale pointer. That's an unusual case though.

So, tempted to mark this as "wontfix".

comment:2 Changed 12 years ago by tk

Hmmm is there a getForm() function? If so I'm missing it... basically my problem stems from another bug that sounds like what I'm experiencing, but is marked as fixed...

(I emailed the contrib list about this actually)

I need a way to programatically submit forms that still works with dojo.connect(form, 'onsubmit', 'handler') and right now dijit.form.Button breaks that in every attempt I've made *unlesS* I create a normap input type=submit and display:none it and then change dijit.form.Button to type="" and onClick = dojo.query(/* and here is where the form reference need comes in */ 'input[type="submit"], this.form)[0].click(); (there are many forms inside tabContainer so I have to narrow the scope and not all the forms have ID's or unique identifiers (dynamically generated)) this bypasses the broken dijit.form.Button type=submit's method of calling form.onsubmit(); form.submit() (note no object is created or passed by this method of firing onsubmit)

If there is something I'm missing... I'm definately open to being corrected on a better way :)

comment:3 Changed 12 years ago by bill

Nope, there's no getForm() method either, but we could add one. That would be less controversial.

As for the real issue you mentioned, the fix in #4982 looks good to me. I'm not sure why things aren't working for you. Can you attach a test case?

comment:4 Changed 12 years ago by tk

The problem is that node.submit() wont generate an event object, I'll put together a test case and attach.

comment:5 Changed 12 years ago by bill

Resolution: duplicate
Status: newclosed

Closed in favor of #4982.

Note: See TracTickets for help on using tickets.