AJAX-Tips Tutorials
AJAX-TipsTwo Input Prompt Patterns
Are your users regularly get confused on what to write on a blank space when asked to sign up or log in? Input Prompt Patterns is a JavaScript command that could answer that problem for your users.
As the name suggests, the input prompt pattern will give users a hint on what to write in the boxes when the sign up, register or anything they have to fill out online. This is a very useful tool for online companies such as real estate and mortgage companies who want to know more about their prospective client.
Instead of letting their users guess on what they need to write, the input prompt will give them a hint on what to write. This will easily increase usability of a website without having too much of an upgrade.
Although there are a lot of input prompt patters out there, these are two of the most popular today that could be useful especially on an Ajax based website.
• defaultValueActsAsHint – This function only has 18 command lines but could be highly efficient when run in an Ajax or JavaScript online applications. Developers just needs to indicate the command ('element_id').defaultValueActsAsHint() in their application.
The rest of the commands on other lines depend on the developer’s preferences. The font could be changed and could be easily customized as it follows today’s standards on color and font. When the user clicks on the box the default value will be automatically removed. The user can reload the prompt again by simply clicking outside the box. This function could work with different libraries but the author uses prototype to demonstrate the function.
• ToggleVal – As always JQuery also has its own version of Input Prompt Pattern. Developed by Aaron Kuzemchak, ToggleVal differentiates itself from other Input Pattern tools since it can be integrated to a JavaScript application as a plug-in. This should not come as a surprise since the tool is specifically geared towards JQuery.
Compared to the previous function, coding ToggleVal is a little bit complicated. However, it provides more customization for the users as it gives various options on how the text will behave once clicked and additional behaviors when the user leaves the box without even clicking on other spaces.
Beauty of JavaScript Revealed
These two Input Prompt Patterns confirms the beauty or more accurately, efficiency of JavaScript. Developers could make some adjustments on their online Ajax or JavaScript based applications if they see something wrong or lacking in their application.
Even though JavaScript have loopholes in security that every developer should be concerned of, the extra effort in security is worth it. An application that provides ease of navigation for users is worth the extra effort.
The two tools are only some of the hundreds of functions that could be used to easily customize the Ajax based application. They don’t require a lot of extra codes for proper implementation. In the case of defaultValueActsAsHint, it’s just a matter of 18 lines wherein ToggleVal is merely a plug-in.
Sponsored Links
