Yesterday, while dabbling with jQuery and getting amazed by the wealth of plugins and effects available for this library, I came across http://digitalbush.com/2008/07/31/masked-input-plugin-114/. It allows you to fit text fields with an input mask to allow only fixed-width input in a certain format. I had seen it first in MS Access a long long time ago.
To use it with GWT-Ext, include jquery.js and jquery.maskedinput.js in your host HTML file. Use <script></script> and not <script/> to avoid wasting time later.
<script language = "javascript" type="text/javascript" src="js/jquery.js" ></script>
<script language = "javascript" type="text/javascript" src="js/jquery.maskedinput.js" ></script>
Now write some native code to call the plugin’s methods:
private native void addPlaceholder(String placeholder, String maskString) /*-{
$wnd.$.mask.addPlaceholder(placeholder, maskString);
}-*/;
private native void mask(String id, String maskString, String placeholderString) /*-{
if(placeholderString != null)
$wnd.$('#' + id).mask(maskString, {placeholder:placeholderString});
else
$wnd.$('#' + id).mask(maskString);
}-*/;
Add the mask to a text field:
addPlaceholder("~", "[+-]");
textField.doOnRender(new Function(){
public void execute() {
mask(textField.getId(), "Rs. ~9999.99/-", " ");
}
});
This will only allow values of the type “Rs. +2345.50/-” with “Rs. ” and “/-” already filled in for the user.
Update: See this: http://gwt-ext.com/forum/viewtopic.php?f=9&t=2984. Thanks mdeg and vanderbill!
BarCampMumbai4 is happening on 4th and 5th of October, 2008 at SJMSOM, IIT, Powai, Mumbai. Its a 2 day camp and you can either present something or be a volunteer. Check out http://barcampmumbai.org/ for registration and other details.
This will be my first BarCamp meet. If you will be around, drop me an email at abhijeet[dot]maharana[at]gmail.com. I would love to meet up with you. See you there!
Google Chrome is all over the place - websites, blogs, Twitter, here, there …. Instinctively, I checked it out just now and my first reaction was “Ah! Its sexy!”. I am sold on the UI alone. Its simple, clean, futuristic. And sexy! I am not going to post the nitty gritty details because you can read about it here. And of course, the comic book!
- The UI, as I have mentioned floored me completely. I like sleek looking apps. Everyone does!
- Task manager: Right click the Chrome task bar button or the title bar ..err.. tab bar to get the Task Manager. Kill individual tabs and plugins to your heart’s content! I killed the Flash plugin and all tabs displayed an error message where Flash content was present. But the tabs and everything else were working fine. This also shows detailed “stats for nerds” in a tab.
- Google Gears: Its integrated right into the browser. Speed difference is quite evident and specially applicable to application shortcuts on the desktop.
- Developer tools: It has a sleek looking DOM inspector. Its like Firebug but a lot could be added. One thing Ill miss for sure is the “Inspect element” button in Firebug. Although I can right click a page element and inspect it, it would have been lot better if it was also within the DOM inspector. Or is it tucked in somewhere and I missed it?
Chrome has generated a lot of excitement. It would be great to see how it influences the web and the developers out there. Till then, I have a few things to figure out:
- How to get the menu bar back (if there is one).
- How to get the status bar to always show up. Not seeing the status bar even for a second gives me creeps!
- What sites to browse with incognito.
- What works and what doesn’t with this shiny new toy.
More than all this, after the terrible experience I had while developing for IE6 few years back, I am hoping that Chrome will clear up some of the mess that web development is. I haven’t had a serious brush with Webkit till now. But I guess its about time to do that.
Update: Jyoti had a weird “The application failed to initialize properly” error and she managed to track it down to this issue: http://code.google.com/p/chromium/issues/detail?id=38. Looks like a lot of people having trouble with it.