Mejora la usabilidad de tus formularios en el campo input text

El tema de la usabilidad es un tema crucial para quienes nos dedicamos al desarrollo web, determina muchas cosas; que el usuario use el servicio, que lo recomiende, que le agrade usarlo étc. El otro dìa visitando la web de jamendo.com (sitio para escuchar música libre) estube analizando varias cosas que me llamaron la atención entre ellas bastantes conceptos interesantes que han inplementado sobre la usabilidad del sitio, de hecho me sorprendió y estoy seguro que el desarrollador de ese sitio conoce mejor que yo  la importancia de la usabilidad hasta en los mínimos detalles, por eso he querido dedicarle estas lineas y si es que me lee por ahi mi mensaje seria "eres seco" jjeje.

Ahora bien como me encantó tanto el concepto de varias cosas las anoté por ahi en mi super agenda para ver si de a poco las voy implementando en mis próximos desarrollos, analicé tambien las lienas de javascript y css tratando de hacer ingeniería inversa pero fué imposible, el código esta ofuscado y cuando logre descubrir las funciones que estaban tras pequeños detalles me di cuenta que se implementaron con javascript solamente "a poto pelado" y carecen de bastante estilod e programación, al leer tanto desastre he pensado que la implementación de dichos conceptos basandome en jquery podría simplificarse bastante y he aqui el primer resultado un concepto  de usabilidad sobre los campos input interesante simple  para el usuario final y simple para el desarrollador basado en jquery.

Típicamente un campo input se ve asi:

 

esa implemntación es más que simple:

<input type="text" value="">

Añadiendole un poco de estilo al campo podríamos lograr cambiar el estilo de la linea, el fondo y el color de fondo al hacer focus sobre el mismo, y hasta ahi llegan los consejos de usabilidad en este campo que puedas encontrar en google. Ahora conun poco de esfuerzo podemos transformar todos nuestros campos input  para agregarles además del color y el estilo de lineas un indicador del uso del campo. Primeros definamos el estilo css:

    <style type="text/css">
    .form .form-txt{
        border: 2px solid #dadada;
        background-color: #f3f3f3;
        color:#2a2a2a;
        font-family: Helvetica, Arial, Sans-serif;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;   
    }
    .form .form-txt:hover{
        border-color:#235485;
    }
    .form .form-txt:focus{
        border: 2px solid #8cc63f;
        background-color: #FFFFFF;
        color:#235485;
   
    }
   
    </style>

Podemos ver que el color de fondo cambia al hacer o no click en conjunto con el color de la linea y el efecto se vería así:

Con esto le indicamos al usuario donde esta parado y que ha habilitado el campo, sin embargo no le hemos indicado que puede escribir sobre el para eso agregaemos la especificación de el css que indique la escritura:

 

    .form .input_escribiendo { /* para aplicarlo a los elementos input type="text"*/
    padding-right: 20px;
    background-image: url("lapiz.png");
    background-repeat: no-repeat;
    background-position: right center;
    min-height:16px; /*altura imagen*/
    }   

Ahora lo usaremos desde un javascript cambiando a dicho estilo solo cuando el input este en focus,  algo muy simple si usas jquery como framework para manejar los elementos dom:

<script type="text/javascript">
	$(function(){
		$('input[type="text"]').focus(function() {
			$(this).css("width",$(this).width()-20);
			$(this).toggleClass("input_escribiendo");
		
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		
		$('input[type="text"]').blur(function() {
			
			$(this).toggleClass("input_escribiendo");
			$(this).css("width",$(this).width()+20);
			$(this).val($(this).val());/*fix para re-reenderizar el valor por desface en ancho*/		
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
	});
	</script>

 El truco es eluso de la función "toggleClass" agregando o quitando el estilo según sea el focus, puedes observar también un pequeño truco sobre el ancho del campo que he realizado, se que esto quita un poco de estilo de programación pero ruego que si alguien encuentra una forma más estética de hacerlo la postee en un futuro quiza lo mejore pero como diría por ahi alguien "lo mejor es enemigo de lo bueno" por eso lo deje como estaba no mas.

$(this).toggleClass("input_escribiendo");

finalmente se verá así:

 

El resultado final puedes verlo acá (adjunto el ejemplo bajo licencia gpl v3):

VER EJEMPLO ONLINE

 

AttachmentSize
demo_inputtext_usables.tar.gz14.73 KB

test

probandoooo

louis vuitton bags

Here has goods estore which will fulfill your dream at an affordable price.Mbt shoes clearance casual shoes designed and

used a multi-layered, single-song follow a unique and meaningful experience. A few pairs of Nike Air Jordan

can keep your muscles and purposeful way, but it is tank to do.You've found

the world's most comfortable Nike Air Jordan. Nike Air Jordanis the leader in New Timberland boots products,

providing top quality products including Nike Air Jordan sale.Buy

your suitable ed hardy bedding? You have the chance to get them

in an easy way! From here, there you can get not only ed hardy

bedding, but also cheap mbt shoes

, Gucci

watch ecommerce , ed hardy caps, ed hardy tanks, ed hardy swimwear, ed hardy sunglasses, cheap handbags wholesaleand more. Most of them

are real love for teenagers. Don’t be missing any chance; just come get your suitable cheap handbags wholesalefrom here. Nike Delta Force AC may let you enjoy the

super comfortable warmth in the winter. Nike Delta Force

ACblew the prevailing wind continued explosive. Its product line also starts not only to be restricted in the

sheep Nike Delta Force AC, gradually

increases UGG Classic Tall Boots which is made of the high-quality sheepskin.
Why I love ,it is nice! serving its customers for the past many years.

buy mbt shoes

cheap mbt shoes sale are the most popular walking shoe today. Last year, Nike Soccer Boot were through the roof. So the question becomes, "Why should I buy a pair? What's in it for me?"discount air sneakers; In this article, I will try to state the case of why everyone should be looking to try the new Jimmy Choo bags from Masai Barefoot Technology.With the Gucci watch ecommerce , versatility is at your disposal. ed hardy bedding shoes Fitness walking is the claim to its fame, but the Masai Barefoot Technology comes in several flavors so there is a shoe that meets any needs.we offer high quality and cheap insanity workout dvd insanity workoutLet you have vigor cheap insanity workout Let you be stronger workout cheap brands jeansLets you easily Nike Soccer Boot schedule keep you motivated ugg bottesFashion styles ugg pas cherwith the latest design trends uggs norgeso fashionable uggs skoSuch a air sneakersdeutschland beautiful cheap mbt shoes ugg saappaat suomesta different designs welcome to buy!

cheap handbags

The annual general meeting of ESN will be held this year in Istanbul. During this event in the biggest city of Europe cheap mbt shoes. will be taken, but maybe even more important, the new board is elected there. During this event 400 participants from all over Europe will represent their section or country.The Nike Soccer Boot design could be better, but it definitely gets the job done. As for cheap mbt shoes colorway, it sure is beautiful.You can lose weight without risk to your health. Found this great experience in shoes, walking in the Gucci watch ecommerce .Nowadays
are notorious for attracting the attention and sense of prestige which is most likely why so many high profile celebrities carry them.Why people love gucci bags ,it have it’s reason,people’s living conditions have greatly improved ,as the times ,the environment is more and more bad , people realize the importance of good health,especially foot healthy.We’ve already covered why you need to own a cheap handbags wholesale and a fashion celebrity accessory.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Eres un robot? completa el captcha