Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capture text box contents onblur or onchange not working

Status
Not open for further replies.

alohaaaron

Programmer
Mar 27, 2008
80
US
Hi, I'm trying to capture the contents of a text box with onblur or onchange after the text box is updated using this calender control. When I use an onblur='alert(this.value)' it is empty because I guess the box hasn't been updated yet because the cursor leaves the box and then needs to click on the date in the calender itself to populate it. If I use an onclick event, it is never fired because the box is still empty when it's clicked. I looked at the calender control.js to try and figure out if I could take the output from that and input it directly into the blur event but haven't figured it out.

Thanks for the help,
Aaron
 
P.S. I know your post title and first sentence mention onchange, but there's no mention of why this doesn't work, so I guessed you might have confused onchange with onclick, which you do mention later in your post.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Hi, Yes I'm using it the same way they have it on their site, code below. How do I grab the date from the calendar or from the text box itself after the user selects a date?
Thanks!

Here is the html used to put it in the web page.
<input name="todays_date" onfocus="showCalendarControl(this);" type="text">
 
You should be able to override the calendar's 'setDate' method, which takes 3 params, Y, M, D, e.g.

Code:
calendarControl.setDate = function(year, month, day) {
   // Do whatever you like with Y, M, D here
}

Be aware you will need to populate the input box yourself if you do this.

Te only other option is to edit their 'setDate' function to do what you want.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top