Customvalidator Doesn't Fire But It Shows The Error Message
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the asp.net custom validator error message not displaying workings and policies of this site About Us Learn more about Stack
Custom Validator Not Showing In Validation Summary
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs custom validator error message javascript Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join customvalidator validationsummary them; it only takes a minute: Sign up Custom Validator firing but it does not update the ValidationSummary up vote 3 down vote favorite Hi I am working on a custom form field validator, it seems like the custom validator is working by not allowing it to continue to the next page, but it doesn't update the Validation Summary
Custom Validator Message Not Showing In Validation Summary
nor does it display the asterisk and the labels that i've made visable. I also have other validators like RequiredFieldValidator on the same field. My ValidationGroup is set, as is the Text and IsValid. I even wrote and set a dummy client side validation method in javascript as some workarounds suggests. here is the validation summary code in asp.net 1471 Points 2673 Posts CustomValidator error message doesnt display Jan 11, 2010 11:00 AM|cubangt|LINK I have a customvalidator to validate the sum of 2 drop downs.. the validation code is http://stackoverflow.com/questions/4308475/custom-validator-firing-but-it-does-not-update-the-validationsummary working, because if the sum doesnt match my logic the page is not submitted, but if i selectvalues that match my logic, the page is submitted.. so iknow the logic is working, but the error message is not working.. and not sure why.. Some background, last week i had this working based on additional controls, but the business decided they wanted http://forums.asp.net/t/1512952.aspx?CustomValidator+error+message+doesnt+display less questions on the form, so all i did was remove the controls from the validation and updated the logic to make sure it was only calculating against the existing controls. reminder that the validation is working( meaning that the page is not being submitted because it failed ) but the error message doesnt display on the page, so no one knows what is happening.. Here is my code Here is the customvalidation code ==================== protected void cvSelectDays(object sender, ServerValidateEventArgs e) { TextBox lastdate = (TextBox)FormView1.FindControl("lastdate"); DataSet dsScheduled = getPayPeriodDates(lastdate.Text.ToString()); DropDownList dwt = (DropDownList)FormView1.FindControl("dwt"); DropDownList vut = (DropDownList)FormView1.FindControl("vut"); DropDownList put = (DropDownList)FormView1.FindControl("put"); RadioButtonList dwtExceptions = (RadioButtonList)FormView1.FindControl("dwtExceptions"); int num = Convert.ToInt32(dsScheduled.Tables["Scheduled"].Rows[0]["scheduled"]); int numsel = Convert.ToInt32(dwt.SelectedValue); int numdiff = (num - numsel); if (dwtExceptions.SelectedValue == "Yes") { decimal r2, r3, tot; if (vut.SelectedItem.Value.ToString() == "-1") { r2 = 0; } else { r2 = decimal.Parse(vut.SelectedItem.Value); } if (put.SelectedItem.Value.ToString() == "-1") { r3 = 0; } else { r3 = decimal.Parse(put.SelectedItem.Value); } tot = (r2 + r3); if (tot <= numdiff) { e.IsValid = true; } else { e.IsValid = false; } } } Post your question and get tips https://bytes.com/topic/asp-net/answers/628024-custom-validator-validates-but-doesnt-tell & solutions from a community of 418,475 IT Pros & Developers. It's quick & easy. Custom Validator validates, but doesn't tell P: n/a https://github.com/1000hz/bootstrap-validator/issues/264 Radu Hi. I have an ASP control on my page: Support Search GitHub This repository Watch 82 Star 1,408 Fork 681 1000hz/bootstrap-validator Code Issues 37 Pull requests 18 Projects 0 Pulse Graphs New issue 'invalid.bs.validator' event : know which custom validator failed #264 Closed nosp4mSnippets opened this Issue Feb 1, 2016 · 0 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 1 participant nosp4mSnippets commented Feb 1, 2016 Hi, It's not a bug but a question... I'm trying to show dynamic error messages based on what content is currently in an input field. By listening to the event : 'invalid.bs.validator' and looking in the event.relatedTarget.validity object it is possible to find which field is wrong and the kind of error, as long as it doesn't come from a custom validator. For example if you have on the same input field, a pattern validator (Only lowercase letters) as well as a required attribute, then validity.valueMissing = true will tell me that the field is empty and so I can override the pattern message or data-error message to show something more appropriate like "This field is required" istead of "only lower case chars are allowed here !" How could I do the same for custom validators ? Example : If you send a file larger than 10Mb "filesize" validator will return false and if you send something else than a zip "validfile" will fire. I'd like to dynamically customise the preset error messages for instance : "Sorry but 'flowers.png' doesn't seem to be a zip file" rather than "Only zip file !" I couldn't find a correct way to determine which custom validator triggered an error except from checking the array that contains these messages in event.detail and doing a comparison on the strings... but that is quite a bad way to do it, isn't it ? Would someone suggest a better idea or a workaround ? Many thanks ! nosp4mSnippets closed this Feb 8, 2016 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You signed in with anoth