PDA

View Full Version : code help please


jayp
01-07-2003, 10:21 PM
I have a readonly text box that is populated by a child window (the child window then closes) when this text box is populated I would like to spawn another child window but am unsure of the event handler required.
Basically.....
A date is entered into the text box, this date is passed to a child window and (via ASP) a DB is checked to make sure that this date is available.
If the date is ok then the child window say "Date ok" and the window will close in 3 seconds. If the date is not ok then the child window will say "Choose another date" close in 3 seconds and clear the contents of the original text box. I only need JS help here as I have the ASP done (including the "Date ok" to the screen bit).
When textbox populated event handler opens window passing the date value, closes in 3 seconds and either clears the textbox or leaves it populated depending on the outcome of the ASP bit.

Jay

ez4ne12c
01-07-2003, 10:31 PM
does onUnload event help?
ez

jayp
01-07-2003, 10:35 PM
...in fact haven't attempted any of it as I wasn't sure about passing the date value and then acting accordingly in the parent window. Have been churning out the ASP side of things while waiting for some kind person to point me in the right Javascript direction :D

whammy
01-08-2003, 12:16 AM
I think you'd be much better off checking in your popup whether the date selected was valid FIRST before passing it back to the parent window - don't close the window until the date has been validated and passed back to the parent, just to keep things flowing logically. That would also make things simpler on you since you would only have one child window to worry about. :)

For example in psuedo code:

IF my date is valid THEN
Show the valid date, and on submit pass the date to the parent window
ELSE
Make them enter a valid date
END IF

P.S. This sounds strikingly similar to the internal "Inventory" application I modified not too long ago - except in my case I didn't let them enter a date, I made them choose from available dates by an associated table key, thereby eliminating having to validate for correct date format, etc. ;)