Okay, so for people who are javascript heroes, what I'm going to write about is ridiculously lame. But I think it's cool.
Yesterday, I was working on an application for a client. Part of it needed to use the fancy lightbox feature for images. But on top of this, the client wanted to be able to not only place captions on the lightbox images, but also make elements of the caption linkable.
This is not hard, but for those not used to writing HTML, much less nested HTML, this can be a challenge--definitely not user-friendly from a client's perspective. The easy solution was to provide a "template" that the user could copy, paste and alter as needed. Unfortunately, this is not a very good solution as slight mistakes can cause terrible problems which are not easily resolved by those who don't know how to fix it, much less what the problem actually is.
So I set out for another solution. I've always admired WYSIWYG editors in that they allow users to easily add complex bits of code (like <a> tags with multiple attributes) through a form, which itself inserts the complied code into another form. Always intimidated by javascript, I thought this would be very difficult to do. However, my needs overshadowed my trepedation, and so I set forth on this glorious crusade.
What I found is that the entire process was extremely EASY. For some reason, I half-expected that this kind of functionality requires a very advanced level of familiarity with Javascript. To the contrary, however, it only requires 1.) that one know how to access form fields from Javascript, 2.) that one know how to concatenate strings into valid HTML equivalents in Javascript and 3.) that one know how to send this compiled information to another form field.
Needless to say, these things are not difficult at all, and after only a few minutes, I had custom solution for my client that would handle the compliation of marginally complex HTML without the client needing to touch any code at all.
Here's what I did.
First, to separate out the peices a bit, I loaded the Javascript form and processing into a pop-up window.
Here's the code, in all its glory:
I'm almost embarrassed at how simple this is. Basically, I just grab the values of each form field, concatenate them as I need to, and then combine my concatenations into one giant, nasty string. Then, using the "window.opener.document" value, I first access the name of my destination form (here "frmNewPost") and then point to the form element to which I want to write my fully concantenated string.
And that's it. Here's an example .
Well, Adobe's AIR (Adobe Integrated Runtime) must be getting ready for primetime, for today a brand-spanking new logo was unveiled.
...
[more]
The last several weeks, readers will note that the majority of my posts have been devoted to AJAX, particluarly Adobe's Spry Framework. My main infatuation is that AJAX allows for clunky page-reload... [more]
Okay, so for people who are javascript heroes, what I'm going to write about is ridiculously lame. But I think it's cool.
Yesterday, I was working on an application for a client. Part of...
[more]
If one has been on the internet for 3 seconds, it is obvious that dynamic photo galleries are useful and popular things. After all, who wants to scroll through pages of pictures when they can all be... [more]
I know I've been posting alot about Spry lately, but the more I use it, the more I love it! Using the simple-to-implement tools which Spry provides, I am able to spend more time dealing with server-... [more]
And He who sits on the throne said, "Behold, I am making all things new."
In an age in which global warming, climate change and concerns about the viability of our planet's environment ar...
[more]
Just a quick reminder: blogactionday (October 15) is approaching rapidly--next Monday! This is a day where bloggers are encouraged to devote a posting to the environment, regardless of their views o... [more]
On the whole, I tend to be fairly loyal in media technologies. I do what I can to support Adobe --I use ColdFusion, the more]
Within the last six months, my little brother has introduced me to some seriously cool music. One of my favorite bands from this "education" is Emery, a hard-hitting "screamo" band hailing from the ... [more]
A few days I blogged about Adobe's release (and sexy-fication) of the javascript framework Spry 1.6. While I have not had a lot of time to play around with the absolutely unique elements, some cool ... [more]
Welcome to my blog. I am often asked what "Exist/Dissolve" means. Well, that is certainly a good question, and I am currently in the process of discovering the answer myself. Prima facie, it strikes me as encapsulating the existensial crisis that is our lives as finite, contingent beings. For a brief moment, we exist, and the next we dissolve into the nothingness of non-existence. From a theological perspective, it is, for me, a sort of ad hoc apologetic for resurrection - i.e., if to exist/dissolve is the human dilemma, there is nothing inherent to the person that guarantees existence, either now or "after" death. Therefore, resurrection is at the same time both the height of absurdity (for it is a notion entirely alien to the paradigm of existence to which we are naturally enculturated) and the only hope for the human to persevere beyond the pale of death.
| deviant monk | |
| mofast-manna | |
| reformed mafia | |
| rose's reasonings | |
| Shawn Dones | |
| scribe |
0 comments logged
Please login to leave a comment