Brad's Blog

Published: 2012-06-11

Building a Happy Potty

ios javascript mobile web

This past weekend, I particpated in Memphis's 48 Hour Launch. It's a weekend-long event where anyone can pitch a business or app idea on a Friday night, try to get enough people to buy into the idea, and form your team. Then, you spend the weekend building something, and on Sunday you get a chance to showcase what you've accomplished. I was fortunate enough to team up with a few friends (and some new ones!) to build ...


Published: 2011-12-13

Chosen.js in the Django admin

chosenjs django javascript jquery python web

Update Nov 23, 2013: I've written a little app (django-chosenadmin) that'll automatically add this to every app. Quite some time ago, I ran across the chosen.js plugin for jQuery and Prototype (I'm using the jQuery flavor). My first thought upon seeing this was, "This would rock in Django's admin app." Yet for some reason, I didn't make that happen.Until recently. I maintain a project where about 10 people use the admin app extensively ...


Published: 2009-07-14

A for AJAX - OR - Dynamically generating options for a select element.

Javascript Prototype ajax web

I don't do a lot of AJAXy web development, but when I do, I usually make use of Prototype. I've recently created a form containing a <select> element whose <option>s are dynamically generated via an AJAX request. The problem however, is that a selected option was already in the form. So before the AJAX request, my HTML looked something like this:<select name="s" id="s"><option value="val1">Value 1</option><option value="val2" selected="selected">Value 2</option><option value="val3">Value ...


Published: 2008-11-24

A simple Django example with Ajax

Javascript ajax django

I often employ Ajax in HTML forms in order to update the list of options in select elements. For example, suppose a form consists of two select elements, and the options in the second depends on the values selected in the first. A simple example of this might be an Automobile Rental website that lets you choose the type of vehicle as well as the color. Not all vehicles come in the same color, though, so you might have a ...


Published: 2008-08-12

How to update an input value with the value from a selected option using Prototype

Javascript Programming web

Today, I needed to set the value of an HTML input element based on the value of a option in a select element. This is fairly easy to do with Prototype's writeAttribute. Here's an example:A simple javascript function to do the work:function populate_input(){ var field = $('tf_select').getValue(); $('tf').writeAttribute('value', field);}A simple HTML snippet to see it in action:<div><p><select id="tf_select" name="tf_select" onchange="populate_input();"><option value="">- choose one -</option><option value="v1">value ...


Published: 2008-06-17

Lions, Tigers, and Web Development Frameworks, oh my!

Javascript Programming Python php web

Apparently I've stumbled upon a problem that has recently faced many web developers. That is, I would like to adopt an open-source web development framework for mid-sized project. Well... searching that phrase only yields 200,000+ results. So how does one choose?I guess Ruby on Rails sparked the whole "Web Development Framework" movement (among other things). I've typically used PHP for my web-based projects in the past, but over the last 2 years, I've also become ...


Published: 2007-02-27

Javascript: What is the standard?

Javascript Programming web

I've recently been writing a little javascript, and I needed to chage the value of some text inside an html/xhtml element. It seems there are several ways to do this, but evey browser may or may not support the same method for doing it (big surprise, here) I'm not sure what is considered the "standard" way. Here's a little script that I use to help me decide which browsers support which methods for altering text within ...