Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Client side script breaks after postback?

0 views
Skip to first unread message

Kurt

unread,
Feb 26, 2004, 10:16:05 AM2/26/04
to
Hi all,

I have a server side textbox on my page that has an OnBlur event that calls a vbscript function which validates the textbox (checks for a valid date) when the user leaves the control. If the date is not valid it shows a message and empties the contents of the textbox. The vbscript is registered in my page_Onload. When the page first loads this works fine, but after a postback to the server I get an error saying 'Object required Text1' , almost as if when the page is posted back it loses reference to my textBox. Does anyone have any idea why?

Thanks in advance for any help with this

Kurt

Suresh

unread,
Feb 26, 2004, 11:41:11 AM2/26/04
to
Kurt,
There's a compare validator that you can use to validate a date entered in a server side textbox. No need for your own vbscript function to handle this.

<asp:comparevalidator id="MyDateValidator" Runat="server" Operator="DataTypeCheck" Type="Date" Display="Dynamic" ErrorMessage="Please enter valid date" ControlToValidate="txtDate"></asp:comparevalidator>

As to why it's not working after postback..
Check the source of the page and see the name of the object is there and it's the same as what you are referencing in your vbscript function.

HTH,
Suresh.

----- Kurt wrote: -----

0 new messages