I am using ASP.NET. I have a text box with an image adjacent to it. When this image is clicked on a model box pops up with a pretty calender. When the user clicks on a date the model box closes and the text box now contains the date – this all works, I have implemented it several times on several web pages for consistency.
The problem comes with the Text Changed event of the text box, it doesn’t fire! It doesn’t fire at all until a post-back occurs! This is a problem for me because I want to add seven days to the date that has just been populated in the text box and display the new date in a label underneath the text box, as soon as the date is visable - a simple thing I want to do, so you would think!?
I have thought about the problem and and after many debugging sessions trying to figure it out I have decided to use Java-Script as you can specify the ‘OnChange’ event for a text box which solves the problem, well half solves it.
I have managed to get the event to work as it displays an alert box on text changed, hurrah! But I have spent several hours trying to use the getElementById and getAttribute functions of the DOM to get the text property of the text box and put the contents in the text property of the label – with no luck.
I have downloaded a java-script debugger that works in Fire-fox and it tells me that the getElementById returns no value. I tried the same code with a <p> instead of a <asp:TextBox> and it works, therefore the problem must be: the asp tags do not work/are not readable with the XHTML DOM structure of the page. Bugger. I have spent an hour browsing forums + google for answers with no luck.
I am annoyed that I cant fix this seemingly simple problem that the client needs. It is past 5pm on a Friday, i am calling it a week.
Any help appreciated.
Recent Comments