Validation Problem--Please Help

byrdunmellow

New Member
I've got a form that has some input boxes. Then there is a button on the<BR>form which has an event Onclick at the server side which validates these<BR>inputs boxes. Actually the asp:requiredfieldvalidator does it. the button<BR>has an onclick event which checks to see is the page is valid or not and if<BR>valid redirects the user to a "THANK YOU" page. but if the user doesn't hit<BR>the OK button and hits Enter, then everything goes haywire, i.e. the user is<BR>not redirected, but stays on the same page. How would I be able to handle<BR>this.<BR><BR>Kind Regards<BR><BR>Verinder<BR>Verinder,<BR><BR>It took me a LONG time to figure out, but I finally read that any button form control will cause a postback. What you need to do is make the redirect button a regular HTML one, then write a client-side script to handle the HTML onClick.<BR><BR>JimTo avoid this prolem.<BR>you can write a cleint side validation in the page_int.<BR>like<BR>Sub Page_Init(sender As Object,e As EventArgs)<BR>IndStartDate.Attributes.Add("onBlur","javascript:if (isNaN(document.newcandidate.IndStartDate.value)){ alert('Industry Start Year (YYYY) should be in numerics'); document.newcandidate.IndStartDate.focus();return false;}")<BR>end sub<BR>thanx<BR>kazacheers<BR><BR>Thanx Guys<BR><BR>Verinder
 
Back
Top