This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date comparision

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I use the above code to check whether the date selected by user is current date and not the future dates. That is date is equal to current date or past date and not future date. But this code(i just want to print them both) seems to be not working.. Please help me ranchers...
[ August 27, 2008: Message edited by: Bear Bibeault ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rajkumar balakrishnan:
But this code(i just want to print them both) seems to be not working.. Please help me ranchers...

Please explain how it is "not working". Does it give you a JavaScript error. Does it give you the wrong output? Does it make the browser crash? What's wrong?
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:

Please explain how it is "not working". Does it give you a JavaScript error. Does it give you the wrong output? Does it make the browser crash? What's wrong?


I call the function in onFocus event of a textfield but when i focus on the textfield nothing happen... No alert box was displayed. This is my problem?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by putting a simple alert at the top of your function, make sure that it _is_ being called.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:
Start by putting a simple alert at the top of your function, make sure that it _is_ being called.


Yep... i do that and the alert box called perfectly and after the if loop only it skips...
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


And i call this here...
<input type="text" name="serialnumber" value="${modelBean.serialnumber}" onFocus="datevalidate()"/>


But there is no response from the script... It doesn't show any alert box and i struggle to know the fact.Please help me ranchers to fix this problem....
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, next hint

Run the code through a debugger, the Firebug tool that comes as a plug-in for Firefox is excellent, you can also use Eclipse or many other javascript debugging tools

If you can't get a debugging tool to work, I suggest you put an alert statement outputing the result of each line of code in in your function



I think you'll narrow your problem down from there
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:
OK, next hint

Run the code through a debugger, the Firebug tool that comes as a plug-in for Firefox is excellent, you can also use Eclipse or many other javascript debugging tools

If you can't get a debugging tool to work, I suggest you put an alert statement outputing the result of each line of code in in your function



I think you'll narrow your problem down from there

Watch my previous post. I have changed my javascript code(and sorry for not mention that)... Thats a very simple code and even that too not working....
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rajkumar balakrishnan:

Watch my previous post. I have changed my javascript code(and sorry for not mention that)... Thats a very simple code and even that too not working....


I still suggest doing the same thing, run your code through the debugger or add an alert statement between each line in your function, you'll narrow down where you when wrong
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:


I still suggest doing the same thing, run your code through the debugger or add an alert statement between each line in your function, you'll narrow down where you when wrong


Sure... i am downloading FireBug and sure post the error here....
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:


I still suggest doing the same thing, run your code through the debugger or add an alert statement between each line in your function, you'll narrow down where you when wrong


FireBug shows just green symbol and no indication of error....
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, try putting an alert statement in between each line of code in your function, see when it stops processing the alerts.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Martijn Verburg:
OK, try putting an alert statement in between each line of code in your function, see when it stops processing the alerts.


It just stop working at the var val2=document.write(year + "/" + month + "/" + date) line and i dont know whats wrong with this code.. Here is my full code

Please let me know whats wrong there..... Help me ranchers..
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rajkumar balakrishnan:


It just stop working at the var val2=document.write(year + "/" + month + "/" + date) line and i dont know whats wrong with this code.. Here is my full code

Please let me know whats wrong there..... Help me ranchers..


OK, that's good work! You've discovered the line that is causing you problems . Now, have a read of what document.write actually does and what it returns.... You're almost there!
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep.... i got it and the problem is with the date formats ... I fix it and now it works perfect....Thanks for all ranchers... who spend their time with me......
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great! Glad to see you solved your problem, well done
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic