Post from Form inside Form

I've got a mass edit form for orders on one of the sites I work on. But each order needed link or button to track the shipments of that order using UPS. Well, today we added FedEx tracking as well. UPS was easy, they do everything via url, so a simple link worked fine. FedEx, not so much, you have to post everything over to them. Obviously that creates a sort of form within a form, and that's not valid html. Javascript becomes required, here's your setup:


Javascript Global Regex Match

I needed to do a case insensitive, multiline, global regex (/img) over some html. The matches kept coming back wrong using $.each() and Mozilla's directions. The while loop on the Mozilla docs site didn't work for me, every time it returned match as "true." That's no help, of course. So, a do while loop instead, and all is well.

Jquery Table Auto Row

Another one mostly for myself, part of a larger picture I'm putting together. This small little javascript object will make it so any table you add a class of "auto-row" will have fun new behaviors. When any select, input, or textarea element in the last row changes, the row is duplicated and added right below. All digits in patterns "like" [##]" are automatically incremented for you before they are attached to the DOM. The row you were editing looses it's special behavior, and the newly inserted row is prepared to do the same.

Text Filter Skeleton

Having to search over text can take a while, this might help speed your work up a bit. The idea is that you pass any text you like through it, and it picks up the "tags" reads the contained settings for you, and handles the replacements. This assumes you're working in PHP, but regexs and logic work everywhere of course. The syntax for these "tags" looks like [tag] or [tag|setting=value|setting2=value].



Subscribe to Fragmented Thought RSS