emmablizzard
New Member
I have a page with the usual email / password text boxes, and a regular expression control to ensure the email address is of the form "[email protected]" but when I run the page, Internet explorer reports that it "cannot find script library webuivalidation.js", I can find no reference to this anywhere on msdn. Any ideas? <BR><BR>Also on the page I have a "send my password" button - how can I ensure the default button (the one executed when the user hits enter is the "login" button, not the "send my password button"?<BR>TIAFor the time being I think you can fix this by adding:<BR><BR><%@ Page ClientTarget="Downlevel" %><BR><BR>to the top of your ASP.NET Web page, because this forces the controls to render to a downlevel browser (i.e., one that does not use client-side JavaScript validation).<BR><BR>The file it is complaining about should be found in:<BR>C:Inetpubwwwrootaspnet_clientsystem_web1_0_3705_0<BR><BR>It should have been there upon installation of the .NET Framework. The file WebUIValidation.js contains the following JavaScript code:<BR><BR>###########################<BR>//<script><BR>var Page_ValidationVer = "125";<BR>var Page_IsValid = true;<BR>var Page_BlockSubmit = false;<BR><BR>function ValidatorUpdateDisplay(val) {<BR> if (typeof(val.display) == "string") { <BR> if (val.display == "None") {<BR> return;<BR> }<BR> if (val.display == "Dynamic") {<BR> val.style.display = val.isvalid ? "none" : "inline";<BR> return;<BR> }<BR> }<BR> val.style.visibility = val.isvalid ? "hidden" : "visible";<BR>}<BR><BR>function ValidatorUpdateIsValid() {<BR> var i;<BR> for (i = 0; i < Page_Validators.length; i++) {<BR> if (!Page_Validators.isvalid) {<BR> Page_IsValid = false;<BR> return;<BR> }<BR> }<BR> Page_IsValid = true;<BR>}<BR><BR>function ValidatorHookupControlID(controlID, val) {<BR> if (typeof(controlID) != "string") {<BR> return;<BR> }<BR> var ctrl = document.all[controlID];<BR> if (typeof(ctrl) != "undefined") {<BR> ValidatorHookupControl(ctrl, val);<BR> }<BR> else {<BR> val.isvalid = true;<BR> val.enabled = false;<BR> }<BR>}<BR><BR>function ValidatorHookupControl(control, val) {<BR> if (typeof(control.tagName) == "undefined" && typeof(control.length) == "number") {<BR> var i;<BR> for (i = 0; i < control.length; i++) {<BR> var inner = control;<BR> if (typeof(inner.value) == "string") {<BR> ValidatorHookupControl(inner, val);<BR> } <BR> }<BR> return;<BR> }<BR> else if (control.tagName != "INPUT" && control.tagName != "TEXTAREA" && control.tagName != "SELECT") {<BR> var i;<BR> for (i = 0; i < control.children.length; i++) {<BR> ValidatorHookupControl(control.children, val);<BR> }<BR> return;<BR> }<BR> else {<BR> if (typeof(control.Validators) == "undefined") {<BR> control.Validators = new Array;<BR> var ev;<BR> if (control.type == "radio") {<BR> ev = control.onclick;<BR> } else {<BR> ev = control.onchange;<BR> }<BR> if (typeof(ev) == "function" ) { <BR> ev = ev.toString();<BR> ev = ev.substring(ev.indexOf("{") + 1, ev.lastIndexOf("}"));<BR> }<BR> else {<BR> ev = "";<BR> }<BR> var func = new Function("ValidatorOnChange(); " + ev);<BR> if (control.type == "radio") {<BR> control.onclick = func;<BR> } else { <BR> control.onchange = func;<BR> }<BR><BR> }<BR> control.Validators[control.Validators.length] = val;<BR> } <BR>}<BR><BR>function ValidatorGetValue(id) {<BR> var control;<BR> control = document.all[id];<BR> if (typeof(control.value) == "string") {<BR> return control.value;<BR> }<BR> if (typeof(control.tagName) == "undefined" && typeof(control.length) == "number") {<BR> var j;<BR> for (j=0; j < control.length; j++) {<BR> var inner = control[j];<BR> if (typeof(inner.value) == "string" && (inner.type != "radio" || inner.status == true)) {<BR> return inner.value;<BR> }<BR> }<BR> }<BR> else {<BR> return ValidatorGetValueRecursive(control);<BR> }<BR> return "";<BR>}<BR><BR>function ValidatorGetValueRecursive(control)<BR>{<BR> if (typeof(control.value) == "string" && (control.type != "radio" || control.status == true)) {<BR> return control.value;<BR> }<BR> var i, val;<BR> for (i = 0; i<control.children.length; i++) {<BR> val = ValidatorGetValueRecursive(control.children);<BR> if (val != "") return val;<BR> }<BR> return "";<BR>}<BR><BR>function Page_ClientValidate() {<BR> var i;<BR> for (i = 0; i < Page_Validators.length; i++) {<BR> ValidatorValidate(Page_Validators);<BR> }<BR> ValidatorUpdateIsValid(); <BR> ValidationSummaryOnSubmit();<BR> Page_BlockSubmit = !Page_IsValid;<BR> return Page_IsValid;<BR>}<BR><BR>function ValidatorCommonOnSubmit() {<BR> event.returnValue = http://aspmessageboard.com/archive/index.php/!Page_BlockSubmit;<BR> Page_BlockSubmit = false;<BR>}<BR><BR>function ValidatorEnable(val, enable) {<BR> val.enabled = (enable != false);<BR> ValidatorValidate(val);<BR> ValidatorUpdateIsValid();<BR>}<BR><BR>function ValidatorOnChange() {<BR> var vals = event.srcElement.Validators;<BR> var i;<BR> for (i = 0; i < vals.length; i++) {<BR> ValidatorValidate(vals);<BR> }<BR> ValidatorUpdateIsValid(); <BR>}<BR><BR>function ValidatorValidate(val) { <BR> val.isvalid = true;<BR> if (val.enabled != false) {<BR> if (typeof(val.evaluationfunction) == "function") {<BR> val.isvalid = val.evaluationfunction(val); <BR> }<BR> }<BR> ValidatorUpdateDisplay(val);<BR>}<BR><BR>function ValidatorOnLoad() {<BR> if (typeof(Page_Validators) == "undefined")<BR> return;<BR><BR> var i, val;<BR> for (i = 0; i < Page_Validators.length; i++) {<BR> val = Page_Validators;<BR> if (typeof(val.evaluationfunction) == "string") {<BR> eval("val.evaluationfunction = " + val.evaluationfunction + ";");<BR> }<BR> if (typeof(val.isvalid) == "string") {<BR> if (val.isvalid == "False") {<BR> val.isvalid = false; <BR> Page_IsValid = false;<BR> } <BR> else {<BR> val.isvalid = true;<BR> }<BR> } else {<BR> val.isvalid = true;<BR> }<BR> if (typeof(val.enabled) == "string") {<BR> val.enabled = (val.enabled != "False");<BR> }<BR> ValidatorHookupControlID(val.controltovalidate, val);<BR> ValidatorHookupControlID(val.controlhookup, val);<BR> }<BR> Page_ValidationActive = true;<BR>}<BR><BR>function ValidatorConvert(op, dataType, val) {<BR> function GetFullYear(year) {<BR> return (year + parseInt(val.century)) - ((year < val.cutoffyear) ? 0 : 100);<BR> }<BR> var num, cleanInput, m, exp;<BR> if (dataType == "Integer") {<BR> exp = /^s*[-+]?d+s*$/;<BR> if (op.match(exp) == null) <BR> return null;<BR> num = parseInt(op, 10);<BR> return (isNaN(num) ? null : num);<BR> }<BR> else if(dataType == "Double") {<BR> exp = new RegExp("^\s*([-\+])?(\d+)?(\" + val.decimalchar + "(\d+))?\s*$");<BR> m = op.match(exp);<BR> if (m == null)<BR> return null;<BR> cleanInput = m[1] + (m[2].length>0 ? m[2] : "0") + "." + m[4];<BR> num = parseFloat(cleanInput);<BR> return (isNaN(num) ? null : num); <BR> } <BR> else if (dataType == "Currency") {<BR> exp = new RegExp("^\s*([-\+])?(((\d+)\" + val.groupchar + ")*)(\d+)"<BR> + ((val.digits > 0) ? "(\" + val.decimalchar + "(\d{1," + val.digits + "}))?" : "")<BR> + "\s*$");<BR> m = op.match(exp);<BR> if (m == null)<BR> return null;<BR> var intermed = m[2] + m[5] ;<BR> cleanInput = m[1] + intermed.replace(new RegExp("(\" + val.groupchar + ")", "g"), "") + ((val.digits > 0) ? "." + m[7] : 0);<BR> num = parseFloat(cleanInput);<BR> return (isNaN(num) ? null : num); <BR> }<BR> else if (dataType == "Date") {<BR> var yearFirstExp = new RegExp("^\s*((\d{4})|(\d{2}))([-./])(\d{1,2})\4(\d{1,2})\s*$");<BR> m = op.match(yearFirstExp);<BR> var day, month, year;<BR> if (m != null && (m[2].length == 4 || val.dateorder == "ymd")) {<BR> day = m[6];<BR> month = m[5];<BR> year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10))<BR> }<BR> else {<BR> if (val.dateorder == "ymd"){<BR> return null; <BR> } <BR> var yearLastExp = new RegExp("^\s*(\d{1,2})([-./])(\d{1,2})\2((\d{4})|(\d{2}))\s*$");<BR> m = op.match(yearLastExp);<BR> if (m == null) {<BR> return null;<BR> }<BR> if (val.dateorder == "mdy") {<BR> day = m[3];<BR> month = m[1];<BR> }<BR> else {<BR> day = m[1];<BR> month = m[3];<BR> }<BR> year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10))<BR> }<BR> month -= 1;<BR> var date = new Date(year, month, day);<BR> return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate()) ? date.valueOf() : null;<BR> }<BR> else {<BR> return op.toString();<BR> }<BR>}<BR><BR>function ValidatorCompare(operand1, operand2, operator, val) {<BR> var dataType = val.type;<BR> var op1, op2;<BR> if ((op1 = ValidatorConvert(operand1, dataType, val)) == null)<BR> return false; <BR> if (operator == "DataTypeCheck")<BR> return true;<BR> if ((op2 = ValidatorConvert(operand2, dataType, val)) == null)<BR> return true;<BR> switch (operator) {<BR> case "NotEqual":<BR> return (op1 != op2);<BR> case "GreaterThan":<BR> return (op1 > op2);<BR> case "GreaterThanEqual":<BR> return (op1 >= op2);<BR> case "LessThan":<BR> return (op1 < op2);<BR> case "LessThanEqual":<BR> return (op1 <= op2);<BR> default:<BR> return (op1 == op2); <BR> }<BR>}<BR><BR>function CompareValidatorEvaluateIsValid(val) {<BR> var value = ValidatorGetValue(val.controltovalidate);<BR> if (ValidatorTrim(value).length == 0)<BR> return true;<BR> var compareTo = "";<BR> if (null == document.all[val.controltocompare]) {<BR> if (typeof(val.valuetocompare) == "string") {<BR> compareTo = val.valuetocompare;<BR> }<BR> }<BR> else {<BR> compareTo = ValidatorGetValue(val.controltocompare);<BR> }<BR> return ValidatorCompare(value, compareTo, val.operator, val);<BR>}<BR><BR>function CustomValidatorEvaluateIsValid(val) {<BR> var value = "";<BR> if (typeof(val.controltovalidate) == "string") {<BR> value = ValidatorGetValue(val.controltovalidate);<BR> if (ValidatorTrim(value).length == 0)<BR> return true;<BR> }<BR> var args = { Value:value, IsValid:true };<BR> if (typeof(val.clientvalidationfunction) == "string") {<BR> eval(val.clientvalidationfunction + "(val, args) ;");<BR> } <BR> return args.IsValid;<BR>}<BR><BR>function RegularExpressionValidatorEvaluateIsValid(val) {<BR> var value = ValidatorGetValue(val.controltovalidate);<BR> if (ValidatorTrim(value).length == 0)<BR> return true; <BR> var rx = new RegExp(val.validationexpression);<BR> var matches = rx.exec(value);<BR> return (matches != null && value == matches[0]);<BR>}<BR><BR>function ValidatorTrim(s) {<BR> var m = s.match(/^s*(S+(s+S+)*)s*$/);<BR> return (m == null) ? "" : m[1];<BR>}<BR><BR>function RequiredFieldValidatorEvaluateIsValid(val) {<BR> return (ValidatorTrim(ValidatorGetValue(val.controltovali date)) != ValidatorTrim(val.initialvalue))<BR>}<BR><BR>function RangeValidatorEvaluateIsValid(val) {<BR> var value = ValidatorGetValue(val.controltovalidate);<BR> if (ValidatorTrim(value).length == 0) <BR> return true;<BR> return (ValidatorCompare(value, val.minimumvalue, "GreaterThanEqual", val) &&<BR> ValidatorCompare(value, val.maximumvalue, "LessThanEqual", val));<BR>}<BR><BR>function ValidationSummaryOnSubmit() {<BR> if (typeof(Page_ValidationSummaries) == "undefined") <BR> return;<BR> var summary, sums, s;<BR> for (sums = 0; sums < Page_ValidationSummaries.length; sums++) {<BR> summary = Page_ValidationSummaries[sums];<BR> summary.style.display = "none";<BR> if (!Page_IsValid) {<BR> if (summary.showsummary != "False") {<BR> summary.style.display = "";<BR> if (typeof(summary.displaymode) != "string") {<BR> summary.displaymode = "BulletList";<BR> }<BR> switch (summary.displaymode) {<BR> case "List":<BR> headerSep = "<BR>";<BR> first = "";<BR> pre = "";<BR> post = "<BR>";<BR> final = "";<BR> break;<BR> <BR> case "BulletList":<BR> default: <BR> headerSep = "";<BR> first = "<ul>";<BR> pre = "<li>";<BR> post = "</li>";<BR> final = "</ul>";<BR> break;<BR> <BR> case "SingleParagraph":<BR> headerSep = " ";<BR> first = "";<BR> pre = "";<BR> post = " ";<BR> final = "<BR>";<BR> break;<BR> }<BR> s = "";<BR> if (typeof(summary.headertext) == "string") {<BR> s += summary.headertext + headerSep;<BR> }<BR> s += first;<BR> for (i=0; i<Page_Validators.length; i++) {<BR> if (!Page_Validators.isvalid && typeof(Page_Validators.errormessage) == "string") {<BR> s += pre + Page_Validators.errormessage + post;<BR> }<BR> } <BR> s += final;<BR> summary.innerHTML = s; <BR> window.scrollTo(0,0);<BR> }<BR> if (summary.showmessagebox == "True") {<BR> s = "";<BR> if (typeof(summary.headertext) == "string") {<BR> s += summary.headertext + "<BR>";<BR> }<BR> for (i=0; i<Page_Validators.length; i++) {<BR> if (!Page_Validators.isvalid && typeof(Page_Validators.errormessage) == "string") {<BR> switch (summary.displaymode) {<BR> case "List":<BR> s += Page_Validators.errormessage + "<BR>";<BR> break;<BR> <BR> case "BulletList":<BR> default: <BR> s += " - " + Page_Validators.errormessage + "<BR>";<BR> break;<BR> <BR> case "SingleParagraph":<BR> s += Page_Validators.errormessage + " ";<BR> break;<BR> }<BR> }<BR> }<BR> span = document.createElement("SPAN");<BR> span.innerHTML = s;<BR> s = span.innerText;<BR> alert(s);<BR> }<BR> }<BR> }<BR>}<BR><BR>###########################<BR><BR><BR>Best of luck, and hope this works for you!