Asp.net Javascript Error Message
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have change custom validator error message javascript Meta Discuss the workings and policies of this site About Us
Asp.net Custom Validator Change Error Message Server Side
Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with set validation error message javascript us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just javascript form validation error message like you, helping each other. Join them; it only takes a minute: Sign up How can I rewrite the ErrorMessage for a CustomValidator control on the client? up vote 6 down vote favorite 1 I have a CustomValidator that is validating a telephone number for several different telephone numbering schemes. The client-side javascript looks like this:
Asp.net Custom Validator Display Dynamic
validatePhoneNumber(sender, args) { cleanNumber = args.Value.replace(/\D/, ""); country = $("#" + CountryID).get(0).value; switch (country) { case "North America": args.IsValid = validateNAPhoneNumber(cleanNumber); if (!args.IsValid) sender.errormessage = "* Not a NA Phone #"; break; case "UK": args.IsValid = validateUKPhoneNumber(cleanumber); if (!args.IsValid) sender.errormessage = "* Not a UK Phone #"; break; ... } } The actual validation takes place properly, and the CustomValidator has the correct IsValid property at all times. The sender.errormessage, however, seems to be rewritten just after this function call to it's default value. How can I change the errormessage value, and make it "stick"? asp.net javascript validation client-side ecma262 share|improve this question edited Aug 5 '09 at 2:15 asked Aug 4 '09 at 22:46 Dustman 2,09772638 add a comment| 9 Answers 9 active oldest votes up vote 3 down vote The best way to change the error message of a validator control with image is: sender.innerHTML = "YOUR HTML WITH ANYTHING COME HERE" share|improve this answer edited Jul 25 '15 at 12:05 Falko 6,78572150 answered J
here for a quick overview of the site Help Center asp.net custom validator client side Detailed answers to any questions you might have Meta Discuss how to display error message in javascript the workings and policies of this site About Us Learn more about Stack Overflow the
Asp Customvalidator
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss http://stackoverflow.com/questions/1230281/how-can-i-rewrite-the-errormessage-for-a-customvalidator-control-on-the-client Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up JavaScript: Alert.Show(message) From ASP.NET Code-behind up vote 32 down vote favorite 9 I am reading this JavaScript: Alert.Show(message) From http://stackoverflow.com/questions/5825165/javascript-alert-showmessage-from-asp-net-code-behind ASP.NET Code-behind I am trying to implement the same. So I created a static class like this: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Web; using System.Text; using System.Web.UI; namespace Registration.DataAccess { public static class Repository { /// Learn Bootstrap Learn Graphics Learn Icons Learn How To JavaScript Learn JavaScript Learn jQuery Learn jQueryMobile Learn AppML Learn AngularJS Learn JSON Learn AJAX Server http://www.w3schools.com/js/js_errors.asp Side Learn SQL Learn PHP Learn ASP Web Building Web Templates Web Statistics Web Certificates XML Learn XML Learn XSLT Learn XPath Learn XQuery × HTML HTML Tag Reference HTML Event Reference HTML Color Reference HTML Attribute Reference HTML Canvas Reference HTML SVG Reference Google Maps Reference CSS CSS Reference CSS Selector Reference W3.CSS Reference Bootstrap Reference Icon error message Reference JavaScript JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference AngularJS Reference XML XML Reference XSLT Reference XML Schema Reference Charsets HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 HTML Symbols HTML UTF-8 Server Side PHP Reference SQL Reference ASP Reference × HTML/CSS HTML Examples CSS Examples W3.CSS Examples Bootstrap Examples JavaScript JavaScript Examples asp.net custom validator HTML DOM Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples XML XML Examples XSL Examples XSLT Examples XPath Examples XML Schema Examples SVG Examples Server Side PHP Examples ASP Examples Quizzes HTML Quiz CSS Quiz JavaScript Quiz Bootstrap Quiz jQuery Quiz PHP Quiz SQL Quiz XML Quiz × JS Tutorial JS HOME JS Introduction JS Where To JS Output JS Syntax JS Statements JS Comments JS Variables JS Operators JS Arithmetic JS Assignment JS Data Types JS Functions JS Objects JS Scope JS Events JS Strings JS String Methods JS Numbers JS Number Methods JS Math JS Dates JS Date Formats JS Date Methods JS Arrays JS Array Methods JS Array Sort JS Booleans JS Comparisons JS Conditions JS Switch JS Loop For JS Loop While JS Break JS Type Conversion JS RegExp JS Errors JS Debugging JS Hoisting JS Strict Mode JS Style Guide JS Best Practices JS Mistakes JS Performance JS Reserved Words JS JSON JS Forms JS Forms Forms API JS Objects Object Definitions Object Properties Object Methods