The Wilson Project Blog of UX/Front-End Developer Ivan Wilson

Menu Skip to Navigation

The Well-Dressed Submit Button

(Originally published on CDG Interactive/Innate blog)

Hello, again. This is CDG User Interface Developer Ivan Wilson with another lesson gleaned from the top of the snowy, white-capped mounds of work that keep me busy every day. As I explained in my last post, my job is about building the bridge between design and technology. I need to create things that function perfectly, look good, and are useful for users. Here’s how I tackled a recent challenge on-the-job.

One of our clients, Mondial Assistance, is a large multinational provider of travel insurance. We’re in the midst of revising each of their national B2C sites—more than 20 sites in all, in a variety of different languages. Our core website needs to work as well for consumers in Germany as it does for consumers in Japan—and everywhere in between. And as every web pro knows, content is key.

But what does content have to do with me, a developer who doesn’t deal (directly) with the spoken language? Allow me to explain!

The truth is, content is inextricably tied to both design and technology. Think, for example, about the humble button on a web form, like this one. As a UI professional, I need to make sure that this button looks right from a design perspective, and also functions perfectly regardless of the browser or language.

The simplest solution would be to just take that graphical image and turn into a submit button via HTML code. Or would it? Remember, this little button has to function across 20 sites and in multiple languages. Just imagine the following conversations…

“Nice button. Nice style. Can you add it to the German site? Oh, don’t forget. The French site is launching next month. We need to use the same buttons there as well.”

OK, open up Photoshop (or insert your preferred graphics program) and change the text to German. Done. Fine.

Repeat again…this time in French.

Repeat again…this time in [insert local language here]

Before you know it, you’re creating 20 versions of the same button. And that’s just one button on the site. Take into account all of the other buttons that reside on the site, and it becomes an algebra problem: (# of buttons) x (# of languages) = massive headache.

Let’s take a step back and look at the problem again.

We need a submit button that is:

  1. Editable – It needs to be easy to translate and manage across sites
  2. Usable – We do not want to create problems or lock out the user, preventing them from finishing their task

Graphical buttons are out. Sure, I could always use a linked image with a Javascript function to submit data upon clicking. But what if Javascript isn’t switched on? (Surely it won’t be on screen readers and mobile phones). Not good enough.

The challenge is creating a default state for the button, which functions for everyone, and an enhanced state that looks perfect for top browsers.

In the end, here’s what I did:

  1. Used an old fashionedHTML submit button
  2. Along with the button, I added an extra bit of code that displays the enhanced state:<span class=”startquote submit”><span>Start Quote</span></span>In this code, I’m using CSS to turn two tags (spans) and enclosed text to appear as the prior graphical button. And by adding Javascript, I can make this “button” act like a regular submit button.

OK, but now we have two “buttons”. Here is where the magic comes in…

If you load up the page (without CSS or Javascript), you are the “default” state and the standard HTML submit buttons shows up.

Now, if you are using a top-of-the-line browser, you have Javascript and CSS well supported. That means that you are ready for the “options” state. When the HTML button loads up, you will get this functional stylized button. All along, the “default” button is still around, just hidden from sight.

And as the topper, since the text is only text, it can be changed with a couple of keystrokes. Done right, it can stretch to accommodate different word lengths due to translation or editing. As seen below:

Why only the Latin alphabet? What about Cyrillic? Japanese? Chinese?

Everything works beautifully. (Well, actually, IE6 has problems with hover states…but it’s IE6, of course.)

So, there it is. Highly stylized yet functional submit buttons – well dressed for any occasion. And best of all…useful.