-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When viewOrForm.$el
is undefined, use $.find
, not $.children
?
#104
Comments
Hi @david-davidson which version are you using? |
Hi @rhubarbselleven, I agreed with @david-davidson. It would be great if getForm will use jquery find method instead children. |
@rhubarbselleven, sorry for the delay! I'm on |
Coolies, anyone interested in a quick PR? |
Will do! |
Thanks for your perseverance on this one @david-davidson |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
I just ran into trouble with form serialization in a Marionette app. Turns out my problem involved Syphon's
getForm
function--specifically, the fact that it uses$.children
, not$.find
, to look for form inputs when passed a specific form, not a view.My use case: I was passing a form to Syphon using
Syphon.serialize(this.$('#my-form-id')[0])
. (My view was a CompositeView whose$el
included other forms [introduced by child views], so.serialize(this)
would be too broad.) The form in question looked roughly like this:...that is, with multiple levels between the outer
<form>
tags and the inputs that I care about.Within Syphon, in
getForm
,_.isUndefined(viewOrForm.$el)
returnedtrue
, since the form itself doesn't have an$el
. That meantgetForm
returned$(viewOrForm).children(':input')
. But since$.children
only looks one level deep, Syphon didn't find any matching elements and didn't extract any data.So: since
Backbone.View.$
, which you use to handle views, uses$.find
, and since$.find
would find everything$.children
does, why not go with$.find
here, like this? master...david-davidson:use-jquery-findThanks for your time, and for your tremendously useful product!
The text was updated successfully, but these errors were encountered: