Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Validation Summary vs Javascript

Posted on 2009-04-07
13
Medium Priority
?
721 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 9

Expert Comment

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

Author Comment

by:GPSAddict
ID: 24091824
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
ID: 24091889
try enabling EnableClientScript="true" in Validation Summary

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:AsishRaj
ID: 24091895
0
 

Author Comment

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

Expert Comment

by:AsishRaj
ID: 24092370
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
 

Author Comment

by:GPSAddict
ID: 24093045
It still submits the form...
0
 
LVL 9

Accepted Solution

by:
AsishRaj earned 2000 total points
ID: 24093123
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 2000 total points
ID: 24093127
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
ID: 24096744
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
ID: 24096773
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
ID: 24101161
Please post your Validation Summary Code. so that i can see whats happening
0
 

Author Comment

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…
Suggested Courses

636 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