Would you be more specific about which events would be bubbling and causing an
issue?
As suggested, I’ve changed the code to add a validator on doc ready now, and
the same issue exists.
On moving the form, one would have to move the form before validation occurs,
and if there is something that fails, how would you let the user correct the
mistakes.
I realise this is a thorny issue, especially as HTML doesn’t allow for nested
forms…
Anyhoo, attached is the updated example, with a patch for element selection in
a form.
This should bring IE in line with other browsers and should be called instead
of form.elements.
What do you think?
Ant
PS. I’ve also added a this.each to the validate function so that you can add
validation to multiple forms.
This is a breaking change as it no longer returns the validator object, so
probably not an option
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jörn
Zaefferer
Sent: 27 October 2008 21:34
To: [email protected]
Subject: [jquery-dev] Re: [validate] jquery validate picks up sub form elements
in ie
The fix isn't so trivial: To support subforms, the plugin must also handle
events bubbled from the subform to the parent form, and ignore those.
Also weird in your example: You call the validate method only within a submit
handler. The validate method itself binds a submit event, and this commonly
fails on IE.
Also, to actually handle the submit, you could append the subform back to a
different parent in the submit handler, validate it, and move it back. Not sure
if this works, but you should fix the previous issue first.
Jörn
On Mon, Oct 27, 2008 at 9:16 PM, Anthony Johnston <[EMAIL PROTECTED]> wrote:
I don't know if this constitutes a usecase, but here's my scenario..
I have a form which is on a panel, that moves.
This form contains a list of items which has an active and index per item.
When you click on a list item a new form appears where you can edit the details
of the item.
You could position the sub-form absolutely, but the moving panel means that
you'd have to keep a track on it and move the sub-form appropriately. It's much
easier to append the form to the list item and let the browser take care of
positioning.
Also, I did try absolutely positioning the form and there were pixel
differences in the three browsers I tried.
The real trouble is that using the jquery.validation.form() method throws an
error
See attached, in IE
1. click submit first, no problem
2. choose an item, to move the details form to the list form, boom
Ticket here http://dev.jquery.com/ticket/3527
I'm sure this will come up again, and it's an eenie weenie fixeteenie
Ant
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jörn
Zaefferer
Sent: 27 October 2008 18:30
To: [email protected]
Subject: [jquery-dev] Re: [validate] jquery validate picks up sub form elements
in ie
I haven't yet seen a usecase where nested forms where actually required. Ajax
uploads can be done by moving the file input field into a sibling form and
uploading the file from there. So currently I see no reason to "fix" this in
the validation plugin. If you still think it should be covered, please create a
ticket: http://dev.jquery.com/newticket
Jörn
On Mon, Oct 27, 2008 at 6:59 PM, Anthony Johnston <[EMAIL PROTECTED]> wrote:
Your right, it comes about when you have a structure where
you want to provide a sub form for details of items in a list
which is in a form or using something like ocupload, where
a subform is put in place of an input[type=file].
But the point is really that the current jquery property used
ie form.elements, yields a different result in different browsers
Ant
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Diego
A.
Sent: 27 October 2008 17:48
To: [email protected]
Subject: [jquery-dev] Re: [validate] jquery validate picks up sub form elements
in ie
Feel free to correct me if I'm wrong but I'm pretty sure that's not valid code.
You shouldn't have a form within a form...
2008/10/27 Anthony Johnston <[EMAIL PROTECTED]>
I have a problem whereby the validate function picks up :inputs in a sub form,
but only in IE
<form>
<input name=one />
<input name=two />
<form>
<input name=three />
<input name=four />
</form>
</form>
In ie
form.elements.length == 4
In others
form.elements.length == 2
to get round it you could remove elements matching "form :input"
line 413 in jquery.validate.js
return $(this.currentForm)
.find(":input")
.not($(this.currentForm).find("form :input"))
.not(":submit, :reset, :image, [disabled]")
.not(this.settings.ignore)
.filter(function() {
…
});
The same thing also happens in serializeArray, so extra fields are sent on form
submits
Has anybody else come across this?
Ant
--
Cheers,
Diego A.
Emo Philips - "My computer beat me at checkers, but I sure beat it at
kickboxing."
* [X]Item 1
* [X]Item 2
* [X]Item 3
[Submit]
Name [ ]
Description
[Submit]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---