Greg Pettit

Ottawa, Canada

gregpettit.ca

Age: 39

I will probably ask questions you'd rather not bother answering. But if you decide to, I promise to pick up the slack next time someone asks something similar. ;-)

Family blog: monkey-house.ca

Twitter: @gregpettit

Work: filecatalyst.com

May
13
comment How to strip all parameters and the domain name from a URL using javascript?
That regex is removing the first character.
May
9
comment How do I get div not to display if value in another div is empty in Javascript?
Yes, I agree with that. Cosmetically hiding it is probably only the second-best plan. Better to not render it at all. Sometimes APIs return data beyond our control, but if we can control it, not rendering is the better choice.
May
9
comment How do I get div not to display if value in another div is empty in Javascript?
If it's a requirement for the cells to be empty, this is the right way to mark it up. I don't know enough about the requirements to judge. ;) If the whole row becomes "useless", cosmetically hiding it is probably only the second-best plan... there might be a better way to just not render the row at all.
May
9
comment How do I get div not to display if value in another div is empty in Javascript?
Pretty clever! I'm undecided on if it's crossing the "too clever" line (like ternary operators do) but I definitely appreciate the approach: I thought mine was pretty generic, but this is even more so (and I mean that in the good way).
May
9
comment How do I get div not to display if value in another div is empty in Javascript?
Cool beans. You can play around with it in the fiddle until it's where you need it to be. For example, the function is getting ALL <tr> elements; you might want to make that particular selector more customizable for only particular tables or whatnot.
May
8
answered How do I get div not to display if value in another div is empty in Javascript?
May
8
comment How do I get div not to display if value in another div is empty in Javascript?
You should use a shared class to identify all the "left" parts as a collection, then iterate through them. For each one, traverse the dom for the contents you need (.next will probably come in handy) and see if they're empty (=== "" should be sufficient). Then show or hide the entire row. If you want to stop the iterator as soon as a blank is encountered, you can just get out of the loop.
May
8
comment How do I get div not to display if value in another div is empty in Javascript?
You're using CSS classes as ID's. You should have a shared class or just a common selector ("td div" would probably work) which all have the same float, width, and height. Then you can use IDs if you really need them to hook into your JS.
May
1
comment Using deployJava.runApplet to target specific element
Thanks for the answer! It's funny how some questions have a slow burn, and people keep noticing clever ways to solve problems. Much appreciated!
Apr
30
comment xhr2 file upload - accessing filenames with formData
Awesome, thanks for your time Ray. I'll look into Fine Uploader as well as your other more general suggestions. We'll have to have an offline discussion about licensing if FU seems like the answer for us.
Apr
30
comment xhr2 file upload - accessing filenames with formData
Thanks, Ray. I will definitely look into Fine Uploader. Can you send additional information with the request using Fine Uploader? I could always pre-tally the expected number of files, send it up with the file(s) and then have the server watch a counter and send back some sort of reply with a redirect URL and "redirect true" flag once the expected number of files is reached...? The URL I post to will have an ID set on it, and the server has an object with that ID, so I can keep track of all uploads related to that particular "session" as it were.
Apr
30
comment xhr2 file upload - accessing filenames with formData
Which of the two methods better meets my 3 design criteria (the 3 points listed), and am I stuck using either of the two options described at the bottom or is there another object/API that gives me what I need that I happen to be overlooking?
Apr
30
revised xhr2 file upload - accessing filenames with formData
added 5 characters in body
Apr
30
comment xhr2 file upload - accessing filenames with formData
Thanks Ray. Already mentioned that I caught it being set wrong. Unfortunately, picking away at code syntax isn't helping me see the light for my actual problem!
Apr
30
comment xhr2 file upload - accessing filenames with formData
Thanks, idbehold. The sample code I grabbed it from sets content-type; however, it's possible that it just gets overridden. Either way, the transfer works. I'm setting it wrong for the single file example (should be application/octet-stream I believe)
Apr
30
revised xhr2 file upload - accessing filenames with formData
Clarified my problem.
Apr
30
asked xhr2 file upload - accessing filenames with formData
Apr
24
accepted Ajax form upload progress bar
Apr
24
comment Ajax form upload progress bar
Nix that... I don't know if I was viewing a cached version or what, but it is now working! Thanks for your help; the recommended libraries are still on my list to research, but this is really the solution I was after.
Apr
24
comment Ajax form upload progress bar
Yeah, I have an empty src attribute and included an action. The upload does fire up; it's just not allowing the Ajax calls for progress (in Chrome).
1 2 3 4 5