Spartan Java

Tag: html

Enabling “Enter” in a form without a submit button

by ricardoz on Oct.13, 2009, under JavaScript, Tips

I find it quite annoying when I can’t post/confirm a web form using the Enter key.

Here is a nifty little javascript trick to do it when you do not need/want a submit input in your html.
(continue reading…)

Leave a Comment :, , , , more...

Blocking multiple clicks real easy

by ricardoz on Aug.10, 2009, under JavaScript, Performance, Security, Web related

I’ve faced this problem a few times before, but this time I decided to find a generic solution to it. I needed to prevent users from clicking action links in a web application multiple times and therefore triggering some server side action a lot of times when only one time was enough/needed.

After looking around for a few hours for an elegant solution I just couldn’t find one, all the articles/answers I found required controls on each link and/or special handling on the server side code that reacted to them.
(continue reading…)

2 Comments :, , , , , , , , more...

Paginated lists made really easy (part 1 of 2 – front-end)

by ricardoz on May.14, 2008, under Articles, JavaScript, Web related

You have to display a list of items in a web application, for each item allowing several operations (ie modification, deletion, etc.). The list can potentially be quite long, so pagination is required.
This scenario is common in backoffice web applications and public web sites, be it for administering information or as search results display, etc.

I’ll describe a simple way to implement a lightweight pagination engine that minimizes load on the server and gives the user the better experience possible. In this first installment I’ll focus on the front-end side, describing how to lay out the HTML, load it using AJAX and implementing the basic operations the user needs to navigate in your paginated list.
(continue reading…)

4 Comments :, , , , , , , more...

AJAX autocomplete

by ricardoz on Apr.17, 2008, under JavaScript, Tips, Web related

Using a nice AJAX auto completable input box is much nicer (for the user) than a combo box with 100 options. If you use jQuery, you may use a quite easy yet powerful plug-in called jquery.autocomplete (original, eh?). Grab it at http://www.pengoworks.com/workshop/jquery/autocomplete.htm.
(continue reading…)

3 Comments :, , , , , , , , more...

Long fields breaking your HTML?

by ricardoz on Apr.06, 2008, under Tips, Web related

I guess in more than one time you needed to display some text in a space where it not always will fit. For example graphical designers love to lay out lists and tables and purposely forget about how long each field will really be ;)

A solution I like is to display always a fixed number of characters and add the full text as a title (mouse over display). A really easy way to do this is using the substring function from the JSTL functions library, for example:

1
2
3
<span title="${myBean.myProp}">
${fn:substring(myBean.myProp,0,25)}
</span>
Leave a Comment :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...