This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to make Change in text field whenever i choose a date from calender image. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to make Change in text field whenever i choose a date from calender image. " Watch "How to make Change in text field whenever i choose a date from calender image. " New topic
Author

How to make Change in text field whenever i choose a date from calender image.

swati mittal
Ranch Hand

Joined: Oct 21, 2008
Posts: 39
I have two text field for date, one have inception date and other have expiration date.
I have put an calender image with inception date text field.

Requirement is - Whenever i select inception date from calender then one java script is called to automatically calculate expiration date based upon inception date.

Problem is - expiration date field should be fill automatically with date whenever i select inception date. i have put onchange on field but its not working properly. can anybody help me regarding this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Please take the time to choose the correct forum for your posts. This forum is for questions on JSP.

For more information, please read this.

This post has been moved to a more appropriate forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

swati mittal wrote:... but its not working properly.

Is your keyboard bursting into flame? Computer spitting acid on you?

Please read this.
swati mittal
Ranch Hand

Joined: Oct 21, 2008
Posts: 39
According to me it is a jsp question because i m working on jsp.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
JSP is just a view technology. If you write Javascript in a JSP file and have problems with Javascript, it still doesn´t make it a JSP problem. To prove it, copypaste it into a plain HTML file and you´ll see that the same problem still exhibits.

And please tell the details, yes. What happens and what happens not? How can we reproduce the same problem?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
onchange event only fires when the user changes the text. It does not change when JavaScript changes it.

You either need to change the calendar code to do what you need or you have to build your own listener which is sort of a waste of computer resources.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

swati mittal wrote:According to me it is a jsp question because i m working on jsp.
Your question has nothing to do with JSP. Please post in the correct technology forum. Thanks.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Hi swathi , AJAX is one of the solution or else

You can go for onchange event , post your code so that i can help you .


If you want something you never had do something which you had never done
 
jQuery in Action, 2nd edition
 
subject: How to make Change in text field whenever i choose a date from calender image.
 
Similar Threads
Calender component
Calender Object
startdate,endDate validations how is it done?
Disabling a text field when another text field has some input
Help with update