SmartGwt DateItem useTextField=true - how to make text entry field UNeditable

Posted by Paul on Stack Overflow See other posts from Stack Overflow or by Paul
Published on 2011-02-15T21:43:33Z Indexed on 2011/02/17 7:25 UTC
Read the original article Hit count: 370

Filed under:
|
|

Since I can't figure out how to solve my problem presented here I'm thinking for the moment at a temporary solution.

I have a smartgwt DateItem widget:

DateItem date = new DateItem("Adate");
date.setWidth(120);
date.setWrapTitle(false);
date.setAttribute("useTextField", true); 
date.setAttribute("inputFormat", "yyyy/MM/dd");
date.setAttribute("displayFormat", "toJapanShortDate");

Because the attribute useTextField is set to true we can see the text entry field. How can I make this text entry field to be uneditable. Actually I want to have only the possibility to choose the date from calendar and not to change it manually.

Resolved - the issue exposed above - thanks to @RAS user.

TextItem textItem = new TextItem();
textItem.setAttribute("readOnly", true);
date.setAttribute("textFieldProperties", textItem); 

Related link

But I have now another issue: The date chooser won't show the date on the text field but Today's date. For example, enter 30/05/2009 on the text field, go to another field, then come back on click on the date chooser and the selected day will be Today's date instead on June 30th, 2009. Which is the reason for this? Can this be solved?

Also let's say I let to the user to opportunity to manually modify the date - can I put some validators on it?

Thank you.

© Stack Overflow or respective owner

Related posts about gwt

Related posts about date