Please Wait Screen - ASP.Net Validators
-
Hi All I have an application that allows users to load contracts. All the fields on the new application screen have asp.net validators against them including come range validators etc. What I want to do is... if the page is valid (client side using javascript) is to show a please wait screen similar to that created by Mike Ellison on code project (Thanks Mike) on the onclick event. If the page is not valid then don't show the wait screen. I have managed to get this to work by the following code (javascript) being called on the save button onmouseup event. function showwaitscreen(bln) { var i; var b; Page_ClientValidate(); for (i = 0; i < Page_Validators.length; i++) { document.getElementById(Page_Validators[i].controltovalidate).focus(); if (!Page_Validators[i].isvalid) { //alert(Page_Validators[i].id + " " + i); b = true; break; }else{ b = false; //alert(Page_Validators[i].id + " " + i); } } if (bln == true && b == false) { document.all.pleasewaitScreen.style.pixelTop = (document.body.scrollTop + 100) document.all.pleasewaitScreen.style.visibility="visible"; }else{ document.all.pleasewaitScreen.style.visibility="hidden"; } } It works a treat EXCEPT.... the onclick event server side no longer fires!!! Weird. Can anyone help? im going slightly MAD!!! Cheers Graeme :wtf:
-
Hi All I have an application that allows users to load contracts. All the fields on the new application screen have asp.net validators against them including come range validators etc. What I want to do is... if the page is valid (client side using javascript) is to show a please wait screen similar to that created by Mike Ellison on code project (Thanks Mike) on the onclick event. If the page is not valid then don't show the wait screen. I have managed to get this to work by the following code (javascript) being called on the save button onmouseup event. function showwaitscreen(bln) { var i; var b; Page_ClientValidate(); for (i = 0; i < Page_Validators.length; i++) { document.getElementById(Page_Validators[i].controltovalidate).focus(); if (!Page_Validators[i].isvalid) { //alert(Page_Validators[i].id + " " + i); b = true; break; }else{ b = false; //alert(Page_Validators[i].id + " " + i); } } if (bln == true && b == false) { document.all.pleasewaitScreen.style.pixelTop = (document.body.scrollTop + 100) document.all.pleasewaitScreen.style.visibility="visible"; }else{ document.all.pleasewaitScreen.style.visibility="hidden"; } } It works a treat EXCEPT.... the onclick event server side no longer fires!!! Weird. Can anyone help? im going slightly MAD!!! Cheers Graeme :wtf:
Would moving the onMouseUp event from the save button to a form onSubmit event help? <form id="Form1" method="post" runat="server" onsubmit="return Page_ClientValidate(); showwaitscreen(true);"> Kane
-
Hi All I have an application that allows users to load contracts. All the fields on the new application screen have asp.net validators against them including come range validators etc. What I want to do is... if the page is valid (client side using javascript) is to show a please wait screen similar to that created by Mike Ellison on code project (Thanks Mike) on the onclick event. If the page is not valid then don't show the wait screen. I have managed to get this to work by the following code (javascript) being called on the save button onmouseup event. function showwaitscreen(bln) { var i; var b; Page_ClientValidate(); for (i = 0; i < Page_Validators.length; i++) { document.getElementById(Page_Validators[i].controltovalidate).focus(); if (!Page_Validators[i].isvalid) { //alert(Page_Validators[i].id + " " + i); b = true; break; }else{ b = false; //alert(Page_Validators[i].id + " " + i); } } if (bln == true && b == false) { document.all.pleasewaitScreen.style.pixelTop = (document.body.scrollTop + 100) document.all.pleasewaitScreen.style.visibility="visible"; }else{ document.all.pleasewaitScreen.style.visibility="hidden"; } } It works a treat EXCEPT.... the onclick event server side no longer fires!!! Weird. Can anyone help? im going slightly MAD!!! Cheers Graeme :wtf:
I have figured it out. Simple error on my part. It appears that if I put the showwaitscreen function onto the onblur event of the asp.net button, it works brilliantly. If anyone else wants to know anything about this function please let me know. I only tested it on IE 5.5 and above. Graeme
-
Would moving the onMouseUp event from the save button to a form onSubmit event help? <form id="Form1" method="post" runat="server" onsubmit="return Page_ClientValidate(); showwaitscreen(true);"> Kane
Thanks Kane. I will try this. I realised that the event I used didn't actually work properly after all. It appears that the alert that I placed on the form overrode the onblur event and the wait message still came up. Cheers Graeme
-
Would moving the onMouseUp event from the save button to a form onSubmit event help? <form id="Form1" method="post" runat="server" onsubmit="return Page_ClientValidate(); showwaitscreen(true);"> Kane
Hmmmm nope the onsubmit didnt work either. I am using a asp.net control not the html control. Would this make a difference? I will have another play around and see what I can come up with. If you have anyother suggestions please let me know. Cheers Graeme
-
Would moving the onMouseUp event from the save button to a form onSubmit event help? <form id="Form1" method="post" runat="server" onsubmit="return Page_ClientValidate(); showwaitscreen(true);"> Kane
I changed track slightly. I created a separate page with a link button and a please wait div tag. Then in the page load event of the new page I added the onclick event to the link button. The link button's only code is the redirect to the other page. If is not as quick as javascript, but it is still reasonable. Basically redirecting twice. Once from the code behind on the save button -> to the please wait page, and registering the click event using the registerstartupscript onto the link button and then redirecting to the full page. Not very pretty but it works. Thanks Graeme