1

I want to have the possibility to display a date with the possibility to enter the date manually. For this I've uset the attribute useTextField set to true like:

setAttribute("useTextField", true);

Now I want the format of date to be yyyy/MM/dd.

I've tryed with

setAttribute("displayFormat ", "TOJAPANSHORTDATE");
setAttribute("inputFormat ", "YMD");

but nothing happen.

I need to use attributes. What attribute should I use? And with what value?

Please, need help. Thanks you a lot.

Paul
  • 3,812
  • 10
  • 50
  • 73

1 Answers1

1

You can try

.setDisplayFormat(DateDisplayFormat.TOJAPANSHORTDATE);
Hardik Mishra
  • 14,779
  • 9
  • 61
  • 96
  • I've managed to solve this with `date.setAttribute("useTextField", true); date.setAttribute("inputFormat", "yyyy/MM/dd"); date.setAttribute("displayFormat", "toJapanShortDate");` http://stackoverflow.com/questions/5009896/smartgwt-dateitem-usetextfield-true-how-to-make-text-entry-field-uneditable – Paul Feb 16 '11 at 22:42
  • 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. How can this be solved? Thank you! – Paul Feb 17 '11 at 07:22
  • I've removed `date.setAttribute("inputFormat", "yyyy/MM/dd");` and works fine. Actually `date.setAttribute("displayFormat", "toJapanShortDate");` give the format of the date. "TOJAPANSHORTDATE Short date in format YYYY/MM/DD. Example: 2005/11/4" from [here](http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/types/DateDisplayFormat.html) – Paul Feb 17 '11 at 15:56