Solved

Validation Summary vs Javascript

Posted on 2009-04-07
13
676 Views
Last Modified: 2012-08-14
Hi, I'm using a validation summary. When I set the show msgbox property to true, it'll show the msgbox but only if the page submits. Any way to call the validationsummary from a custom javascript function without submitting the page (static msgbox will do) ? If so, what would be code, thanks.
0
Comment
Question by:GPSAddict
  • 7
  • 6
13 Comments
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
Do the validation in javascript...post you validation code and experts will be more than happy to help you
0
 

Author Comment

by:GPSAddict
Comment Utility
Wouldn't it be easier to let .NET handle all the error processing and simply call the summary in js ? That way I have a single line of code to write...It is possible or not ?

If not, I guess I'd need a generic function that checks if some fields (texboxes, radios, checkboxes and listboxes) are null or empty (with trim).

Oh and the fields are set to run on server.

Thanks
0
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
try enabling EnableClientScript="true" in Validation Summary

0
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
0
 

Author Comment

by:GPSAddict
Comment Utility
I know that but it still requires the form to submit...
0
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
if there is an error it does not post back. - this is the function of  EnableClientScript="true

the link i gave you, it does not postback if there is an error.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:GPSAddict
Comment Utility
It still submits the form...
0
 
LVL 9

Accepted Solution

by:
AsishRaj earned 500 total points
Comment Utility
this is something that you should read

Client-Side Validation  The validation controls always perform validation checking in server code. However, if the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script. With client-side validation, any errors are detected on the client when the form is submitted to the server. If any of the validators are found to be in error, the submission of the form to the server is cancelled and the validator's Text property is displayed.  This permits the user to correct the input before submitting the form to the server.  Field values are revalidated as soon as the field containing the error loses focus, thus providing the user with a rich, interactive validation experience.  

  Note that the Web Forms page framework always performs validation on the server, even if the validation has already been performed on the client.  This helps prevent users from being able to bypass validation by impersonating another user or a preapproved transaction.  

  Client-side validation is enabled by default.  If the client is capable, uplevel validation will be performed automatically. To disable client-side validation, set the page's ClientTarget property to "Downlevel" ("Uplevel" forces client-side validation). Alternatively, you can set an individual validator control's EnableClientScript property to "false" to disable client-side validation for that specific control.  

Source: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/validation/default.aspx

there is a difference from postback and form submit on the client side
0
 
LVL 9

Assisted Solution

by:AsishRaj
AsishRaj earned 500 total points
Comment Utility
This is an article u must read to understand the info indept

Taming the ASP.NET Validation Summary Control -
http://www.asp101.com/articles/manu/validationsummary/default.asp
0
 

Author Comment

by:GPSAddict
Comment Utility
Thanks for links, it helps me understand all of the validators behavior. However, it is still unclear to me how I could, upon a button click,successfully show the content of the validatorsummary msgbox without submitting the page ! In your links I found out what event to use server-side but I have no idea how to retrieve the validatorsummary message (unless it is impossible to do so without submitting ?) Any ideas ? Thanks
0
 

Author Comment

by:GPSAddict
Comment Utility
Please note I am not trying to retrieve the text property of validators but the message that would be returned by the validatorsummary with a msgbox (I want to use a msgbox also). Thanks
0
 
LVL 9

Expert Comment

by:AsishRaj
Comment Utility
Please post your Validation Summary Code. so that i can see whats happening
0
 

Author Comment

by:GPSAddict
Comment Utility
Nevermind, I'll do the complete validation in js. Thanks
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now