0

Error datebox with constraint

asked 2012-08-27 08:23:14 +0800

Marky gravatar image Marky flag of Spain
284 7
http://www.no/havent-doma...

Hi, I have observed some strange beheaveour in datebox. Ww have two datebox. One from a date and the other to a date. When I try to put the date (27/08/0200) into the from datebox i set a constraint into the to datebox and javascript throws a error like this: http://imageshack.us/photo/my-images/109/zkerror27082012.png/
this is my code:

         anyo = "0200";
         mes = "08";
         dia = "27";
	String constraint = anyo+mes+dia;
	dbHasta.setConstraint("after " + constraint);
	System.out.println("after " + constraint);

And I can show in the console: after 2000827

Is this a bug?

regards, Marky

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-08-29 07:04:33 +0800

Marky gravatar image Marky flag of Spain
284 7
http://www.no/havent-doma...

Hi vincentjian,
I solved it!
The problem is when I parse the String with "String.valueOf(gregorianCalendar.get(Calendar.YEAR));". This returns the String without 0 at the beginnin of the string, and the method setConstraint() needs 4 chars for year.
Now i do this:

			if(year.length() < 4){
				for(int i = 0; i < 4 - year.length(); i++ ){
					year= "0" + year;	
				}
			}

Thanks for all!

Regards,

Marky

link publish delete flag offensive edit

answered 2012-08-27 11:06:08 +0800

vincentjian gravatar image vincentjian
2245 6

Hi Marky,

I tried to set constraint when "from" datebox is changed and works correctly. Can you provide more detailed sample code?
Note that the constraint showed in the console is not correct, should be after 02000827.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-08-27 08:23:14 +0800

Seen: 95 times

Last updated: Aug 29 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More