473,382 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

ASPNet validation and Javascript

I have a page that conatins some text boxes that need to be completed
before submission. I used requiredFieldValidators which work very
well.

User being what they are where quite happy, but they wanted an
Hourglass displayed when the page is submitted as they can't remember
whether they have clicked the button.

I found the following javascipt and vb souce that wires the submit
button to a client side javascript that displays the hourgalss and
submits the form, but this ignores the validation controls.

I've reverted to using server side validation to re-display the form
if the boxes are not completed, but this is far from ideal

Anyone any idea on how I can display an hourglass AND use the client
side validation controls, or suggest an alternative.

Form contains a submit button btnSubmit

Pageload code behind file:
btnSubmit.Attributes.Add("onClick", "return doit();")

javascript:

<script language="javascript">
function doit()
{
document.body.style.cursor='wait'
}
</script>

btnsubmit on-click code executes as normal after hourglass displayed

Thanks
Nov 18 '05 #1
3 1321

"Dick W" <ri************@services.fujitsu.com> wrote in message news:d0**************************@posting.google.c om...
I have a page that conatins some text boxes that need to be completed
before submission. I used requiredFieldValidators which work very
well.
[snip] Form contains a submit button btnSubmit

Pageload code behind file:
btnSubmit.Attributes.Add("onClick", "return doit();")

javascript:

<script language="javascript">
function doit()
{
document.body.style.cursor='wait'
}
</script>

btnsubmit on-click code executes as normal after hourglass displayed

Thanks


What if you use "doit();" instead of "return doit();" ? Asp.net adds it's own code
to that event handler but that now never gets reached, as you returned already.
As a remark: do not forget the ";" as it separates your code from the .net added code.

Hans Kesting
Nov 18 '05 #2

Hans,

thanks for the quick response. Removing the return does trigger the
validation controls but, having set the Hourglass it stays like that.
Nearly there


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
Consider a different angle. Add your javascript into the <form onsubmit="">
event.
Use Page.RegisterOnSubmitStatement().

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Dick W" <Di***@superstar.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...

Hans,

thanks for the quick response. Removing the return does trigger the
validation controls but, having set the Hourglass it stays like that.
Nearly there


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: EviL KerneL | last post by:
Hi - I am trying to figure out a way to enforce the validation included for this form based on whether the user chooses "email" or "phone" as the contact choice. Right now it is set to enforce...
4
by: Tim Meagher | last post by:
I am trying to use both validation controls and to add submit button attributes, but when I add the button attributes, the javascript fpr the validation controls is no longer created for the page. ...
16
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
4
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all...
2
by: sonyram | last post by:
As our application design requires us to use one of the validation API engine which was written on C(so basically all I have is a dll) and I tested calling the functions using small windows...
2
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the...
6
by: wandali | last post by:
Hello, I have a problem in finding the status of a panel (visible or not). I have a dropdownlist that associates with a panel in which textbox are embeded in the panel. A client side VBScript is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.