Reineck: Ok, seems that’s also a simplified syntax
Kotzen: If i have var a; in global scope what is it ***igned ?
Gentleman: Zap0: same thing as in any scope.
Kotzen: Ok. i’m a C programmers, trying to comprehend the differences between undefined and null. and also trying to find out if var a; gets ***igned a null by default.
Callier: They are just different
Ament: Can someone help me here? I’m trying to make serializeArray return an array with the boxes that are checked. https://bpaste.net/show/7b565173bd21
Whit: Var a; ‘gets ***igned’ to undefined
Geery: Then you as a dev must do something like a = null; for it to be null
Kotzen: Ok, i got it now! thanks
Gentleman: Persina: what’s “generate_map”
Gentleman: Persina: if it’s the form tag containing the checkboxes, that should just work.
Zieser: Gentleman: the var containing the form
Kotzen: DOMContentLoaded event can have multiple listeners. but how do you determine which order they get run in ?
Truchon: Gentleman: It is a jquery object. I’m getting three seperate objects back from serializeArray
Mashall: Gentleman: I want one object containing all three values
Gentleman: Persina: that makes no sense
Gentleman: Persina: you get an array of objects, each one has a “value” and “name” or label, i forget attribute
Kotzen: Bluezone, sounds like you want an object.
Gentleman: Persina: you could map that array to an array of values, but an object doesn’t make sense.
Gentleman: Since there can be multiple checkboxes with the same name
Gentleman: Bluezone: yes, of course. JS is untyped in that way.
Hjort: Zap0: just want to know if it’s possible so I can avoid iterating over the entire array in my test
Gentleman: Bluezone: that doesn’t mean it’s a good thing to have tho, you should try to keep arrays unityped
Tenenbaum: Persina, jquery do***entation says it’s for forms and form controls
Schweppe: There are typed arrays in ES6
Hascall: Pikul: this is inside a form
Mcnees: Is generate_map a jquery with a form collection?
Gentleman: Persina: an object a key-value map would be incorrect for checkboxes.
Reich: Pikul: generate_map is the form variable
Willia: Gentleman: What do you mean? that is how it is being interpreted by serializeArray
Gentleman: Persina: serializeArray returns an array.
Gentleman: Persina: that array contains N objects, one per checkbox.
Gentleman: Persina: each of those objects has the name of the checkbox, and its value, as properties.
Gentleman: That’s the only sensible data structure to use to represent HTML checkboxes that’s not a query string.
Bramon: Gentleman: yes, I understand. But if there is a group of checkboxes all with the same name I only want one variable to send with the post.
Gentleman: Persina: then you don’t want checkboxes, you want radio buttons.
Gentleman: Checkboxes are for sending multiple values with the same name. radio buttons are for selecting only one out of a group of values with the same name.
Roseboro: Gentleman: radio buttons only allow one option to be checked, I want to allow any number.
Gentleman: Um, then why would you only send one option with the post?
Gentleman: If i check 10 options you should send 10 things
Gentleman: Which is what the browser will do by default
Twiford: Gentleman: I want to send one object containing all the values that are checked. An array of checked values.
Gentleman: Persina: that’s how the browser sends it by default.