Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASPNet validation and Javascript

Reply
Thread Tools

ASPNet validation and Javascript

 
 
Dick W
Guest
Posts: n/a
 
      07-01-2004
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
 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      07-01-2004

"Dick W" <> wrote in message news: 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


 
Reply With Quote
 
 
 
 
Dick W
Guest
Posts: n/a
 
      07-01-2004

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!
 
Reply With Quote
 
Peter Blum
Guest
Posts: n/a
 
      07-02-2004
Consider a different angle. Add your javascript into the <form onsubmit="">
event.
Use Page.RegisterOnSubmitStatement().

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

"Dick W" <> wrote in message
news:%...
>
> 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!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A form validation library with javascript validation Grigory Temchenko Python 0 12-28-2008 08:38 PM
Is the aspnet account called "aspnet" for all non-English versions of Windows and IIS? torus@tpg.com.au ASP .Net 7 03-23-2007 04:00 AM
Upgrade from aspnet 1.1 to aspnet 2.0 Gary Nelson ASP .Net 2 10-14-2005 05:16 PM
microsoft.public.dotnet.framework.aspnet.webcontrols ,microsoft.public.dotnet.framework.aspnet Alfred Sehmueller ASP .Net Web Controls 0 02-20-2004 02:39 PM
Restricting ASPNET ACLs without breaking ASPNET (newbie-ish) Brian Schuth ASP .Net Security 0 09-08-2003 06:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57