Search Results

Search found 209 results on 9 pages for 'validators'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • Zend Framework - validators are not working anymore?

    - by Pavel Dubinin
    Eariler I happily used the following code for creating form elements (inside Zend_Form descendant): //Set for options $this->setOptions(array( 'elements' => array( 'title' => array( 'type' => 'text', 'options' => array( 'required' => true, 'label' => 'Title', 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array('minLength'=>1, 'maxLength'=>50)), ), ) ) )); But now I've noticed that validators are not working.. I suspect this might be due to zend updates.. Does anyone face this problem?

    Read the article

  • Validators are not working anymore in Zend Framework?

    - by Pavel Dubinin
    Eariler I happily used the following code for creating form elements (inside Zend_Form descendant): //Set for options $this->setOptions(array( 'elements' => array( 'title' => array( 'type' => 'text', 'options' => array( 'required' => true, 'label' => 'Title', 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array('minLength'=>1, 'maxLength'=>50)), ), ) ) )); But now I've noticed that validators are not working.. I suspect this might be due to zend updates.. Does anyone face this problem?

    Read the article

  • Zend framework multiple Validators in an array

    - by iSenne
    Hello everybody I want to create a form in Zend framework. I am using the code below for a field: $this->addElement('text', 'username', array( 'label' => 'Username:', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array( 'alnum' ) )); This works. But now I also want to add a new validator. In this case StrinLength $element->addValidator('StringLength', false, array(6, 20)); How can I add this validator in the array I already have? Tnx in advanced

    Read the article

  • ASP.NET: aggregating validators in a user control

    - by orsogufo
    I am developing a web application where I would like to perform a set of validations on a certain field (an account name in the specific case). I need to check that the value is not empty, matches a certain pattern and is not already used. I tried to create a UserControl that aggregates a RequiredFieldValidator, a RegexValidator and a CustomValidator, then I created a ControlToValidate property like this: public partial class AccountNameValidator : System.Web.UI.UserControl { public string ControlToValidate { get { return ViewState["ControlToValidate"] as string; } set { ViewState["ControlToValidate"] = value; AccountNameRequiredFieldValidator.ControlToValidate = value; AccountNameRegexValidator.ControlToValidate = value; AccountNameUniqueValidator.ControlToValidate = value; } } } However, if I insert the control on a page and set ControlToValidate to some control ID, when the page loads I get an error that says Unable to find control id 'AccountName' referenced by the 'ControlToValidate' property of 'AccountNameRequiredFieldValidator', which makes me think that the controls inside my UserControl cannot resolve correctly the controls in the parent page. So, I have two questions: 1) Is it possible to have validator controls inside a UserControl validate a control in the parent page? 2) Is it correct and good practice to "aggregate" multiple validator controls in a UserControl? If not, what is the standard way to proceed?

    Read the article

  • ASP.NET validators alignment issue

    - by Mahesh
    Hi, I am developing contactus webpage which have a input field called Email. It is validated against a required field validator and regular expression validator with appropriate messages. Required: Enter Email Regular Expression: Invalid Email I am setting these two as given below: <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox> <font color="#FF0000">*</font> <asp:RequiredFieldValidator ID="rfvemail" CssClass="error_text" ControlToValidate="txtEmail" runat="server" ErrorMessage="Enter email address."></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revemail" runat="server" ControlToValidate="txtEmail" ErrorMessage="Invalid Email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> My problem is both Enter Email and Invalid Email is occupying its own space. For Ex: If I leave email as empty space and press submit, Enter Email is displaying right next to it. If I enter invalid email(xxx), Enter Email is off but taking the space, Invalid Email message is displayed after these space taken by 'Enter Email' before. Is there any way to remove this space?? Mahesh

    Read the article

  • ASP.NET: How to get same validators control to be both client-side and server-side

    - by harrije
    Hello, For the ASP.NET validator controls, I want to use both client-side validation for the user experience and server-side validation to guard against hackers. ASP.NET documentation leads me to believe that if EnableClientScript="True" then there will be no server-side validation if client-side validation is possible for the user agent. To get server-side validation, the documentation says use EnableClientScript="False", which bypasses client-side validation altogether. Am I misunderstanding how the validator controls work? I ask because it seems obvious that many developers would want both client and server side validation together, and I find it hard to believe both together is not possible with one of the standard validation controls. If I am understanding the ASP.NET documentation correctly, then I can find only two options: Use two validator controls exactly the same except for their ID and EnableClientScript properties. Obviously ugly for maintaining two controls almost the same. Write some code behind to check if postback then invoke the Validate method on the validator group. Why write code behind if there a way to be automatic from the control? Is there a way to do so using a single validator control with no code behind? Thanks in advance for your input.

    Read the article

  • Exploring ASP.NET Validators

    This articlicle digs deep into ASP.NET validators and discuss few case studies which may be a boon for any project...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Executing server validators first before OnClientClick Javascript confirm/alert

    - by kaushalparik27
    I got to answer a simple question over community forums. Consider this: Suppose you are developing a webpage with few input controls and a submit button. You have placed some server validator controls like RequiredFieldValidator to validate the inputs entered by the user. Once user fill-in all the details and try to submit the page via button click you want to alert/confirm the submission like "Are you sure to modify above details?". You will consider to use javascript on click of the button.Everything seems simple and you are almost done. BUT, when you run the page; you will see that Javascript alert/confirm box is executing first before server validators try to validate the input controls! Well, this is expected behaviour. BUT, this is not you want. Then? The simple answer is: Call Page_ClientValidate() in javascript where you are alerting the submission. Below is the javascript example:    <script type="text/javascript" language="javascript">        function ValidateAllValidationGroups() {            if (Page_ClientValidate()) {                return confirm("Are you sure to modify above details?");            }        }    </script>Page_ClientValidate() function tests for all server validators and return bool value depends on whether the page meets defined validation criteria or not. In above example, confirm alert will only popup up if Page_ClientValidate() returns true (if all validations satisfy). You can also specify ValidationGroup inside this function as Page_ClientValidate('ValidationGroup1') to only validate a specific group of validation in your page.        function ValidateSpecificValidationGroup() {            if (Page_ClientValidate('ValidationGroup1')) {                return confirm("Are you sure to modify above details?");            }        }I have attached a sample example with this post here demonstrating both above cases. Hope it helps./.

    Read the article

  • asp.net web apps: are OnServerValidate necessary with custom validators

    - by peroija
    I recently created a .net web app that used over 200 custom validators on one page. I wrote code for both ClientValidationFunction and OnServerValidate which results in a ton of repetitive code. My sql statements are parameterized, I have functions that pull data from input fields and validates them before passing to the sql statements or stored procedures. And the javascript validates the fields before the page submits. So essentially the data is clean and valid before it even hits the OnServerValidate and clean after it anyways due to the aforementioned steps. This makes me question, is OnServerValidate really needed when I validate on the clientside?

    Read the article

  • Is server validation necessary with client-side validators?

    - by peroija
    I recently created a .net web app that used over 200 custom validators on one page. I wrote code for both ClientValidationFunction and OnServerValidate which results in a ton of repetitive code. My sql statements are parameterized, I have functions that pull data from input fields and validates them before passing to the sql statements or stored procedures. And the javascript validates the fields before the page submits. So essentially the data is clean and valid before it even hits the OnServerValidate and clean after it anyways due to the aforementioned steps. This makes me question, is OnServerValidate really needed when I validate on the clientside?

    Read the article

  • Developing a custom-validation in asp.net for specific control and criteria

    - by Gaurav
    Hello There is another relevant question asked Validation Check in asp.net In the same scenario we need a custom validator control which will alert user for any wrong entry. This will work like this : Developer will pass the control-name, input-value and format-required For instance like for textbox it can be: txtName,txtName.Text, allow-alphabets-only The accordingly format if the user input is invalid he/she will be got prompt. Please suggest the right way to do the smae. Thanks in advance.

    Read the article

  • Add class to textbox when invalid, using .Net Validators

    - by CoreyT
    I'm working on a multipage form in .Net using AJAX (UpdatePanels). I am stuck right now trying to get a class added to the textbox that is invalid to basically highlight it red. I found a sample online using this code: $("span.invalid").bind("DOMAttrModified propertychange", function (e) { // Exit early if IE because it throws this event lots more if (e.originalEvent.propertyName && e.originalEvent.propertyName != "isvalid") return; var controlToValidate = $("#" + this.controltovalidate); var validators = controlToValidate.attr("Validators"); if (validators == null) return; var isValid = true; $(validators).each(function () { if (this.isvalid !== true) { isValid = false; } }); if (isValid) { controlToValidate.removeClass("invalid"); } else { controlToValidate.addClass("invalid"); } }); That works perfectly, in IE only. For some reason this code does not ever fire in Firefox. I've looked up the DOMAttrModified event and it sounds like this should work in Firefox, hence it being in the code. I must be missing something though because it does not work. I'm open to other solutions for what I am trying to accomplish here if anyone has something good. Basically the form is 3 pages right now. Page 1 has a variable number of fields that require validation. It could be 5, or 13 fields, based on a checkbox. Page 2 has another set of fields that need to be validated separately. Obviously when I am on page 1 it should not try to validate page 2, and vice versa. Pleas help with either some help to fix the code I have, or an alternative.

    Read the article

  • JSF how to temporary disable validators to save draft

    - by Swiety
    I have a pretty complex form with lots of inputs and validators. For the user it takes pretty long time (even over an hour) to complete that, so they would like to be able to save the draft data, even if it violates rules like mandatory fields being not typed in. I believe this problem is common to many web applications, but can't find any well recognised pattern how this should be implemented. Can you please advise how to achieve that? For now I can see the following options: use of immediate=true on "Save draft" button doesn't work, as the UI data would not be stored on the bean, so I wouldn't be able to access it. Technically I could find the data in UI component tree, but traversing that doesn't seem to be a good idea. remove all the fields validation from the page and validate the data programmaticaly in the action listener defined for the form. Again, not a good idea, form is really complex, there are plenty of fields so validation implemented this way would be very messy. implement my own validators, that would be controlled by some request attribute, which would be set for standard form submission (with full validation expected) and would be unset for "save as draft" submission (when validation should be skipped). Again, not a good solution, I would need to provide my own wrappers for all validators I am using. But as you see no one is really reasonable. Is there really no simple solution to the problem?

    Read the article

  • asp.net compare validators to allow comma and dot (both!) as decimal separator

    - by DanC
    I am using a compare validator, which validates that the entered number is a valid double and also validates it against a given value (greater than zero). I am validating money amounts. Because of the location where the app is used, the locale sets the comma as the decimal separator. The problem is that when a user enters the value using the numeric keyboard, the number gets written with the dot as decimal separator, and is rejected by the validation. I'd like to have this validation done before triggering a postback (like a customvalidator would) and accepting both separators. Any ideas? Thanks

    Read the article

  • How come module-level validators are evaluated only after property-level validators?

    - by jonathanconway
    I'm using the module-level validator: 'PropertiesMustMatch' on my view-model, like so: [PropertiesMustMatch("Password", "PasswordConfirm")] public class HomeIndex { [Required] public string Name { get; set; } public string Password { get; set; } public string PasswordConfirm { get; set; } } I'm noticing that if I submit the form without Name filled in, the ValidationSummary() helper returns only the following error: The Name field is required. However, if I fill in Name, then ValidationSummary() will return a PropertiesMustMatch error: 'Password' and 'PasswordConfirm' do not match. So it looks like the property-level validators are being evaluated first, then the model-level validators. I would much prefer if they were all validated at once, and ValidationSummary would return: The Name field is required. 'Password' and 'PasswordConfirm' do not match. Any ideas what I can do to fix this? I'm studying the MVC 2 source-code to try to determine why this happens.

    Read the article

  • Why doesn't web browsers have built in validators?

    - by August Karlstrom
    As far as I know there is no web browser with built in validators for HTML, CSS and Javascript. Developing web pages without validation is like using a compiler that doesn't do syntax analysis. Even Firefox with its excellent plugins aimed at developers like Firebug lacks plugins for CSS and Javascript validation. Wouldn't it be useful to have these plugins? Am I missing something?

    Read the article

  • Why don't web browsers have built in validators?

    - by August Karlstrom
    As far as I know there is no web browser with built in validators for HTML, CSS and JavaScript. Developing web pages without validation is like using a compiler that doesn't do syntax analysis. Even Firefox with its excellent plugins aimed at developers like Firebug lacks plugins for CSS and JavaScript validation. Wouldn't it be useful to have these plugins? Am I missing something?

    Read the article

  • [IceFaces] Why are validators of unchanged components called?

    - by bitschnau
    I have a IceFaces-form and several input fields. Let's say I have this: <ice:selectOneMenu id="accountMenu" value="#{accountController.account.aId}" validator="#{accountController.validateAccount}"> <f:selectItems id="accountItems" value="#{accountController.accountItems}" /> </ice:selectOneMenu> and this: <ice:selectOneMenu id="costumerMenu" value="#{customerController.customer.cId}" validator="#{customerController.validateCustomer"> <f:selectItems id="customerItems" value="#{customerController.customerItems}" /> </ice:selectOneMenu> If I change one value, the respective validator is called, what is fine. But also the other validator is called, which is not fine, because the user get's an irritating message to insert a value to a field he maybe was just going to pay attention to. It's like poking the user with a stick to "Hurry up now!". BAD! I thought the attribute "partialSubmit" is controlling this behaviour, so only the one DOM-part is submitted, which is affected by the user interaction, but if I declare the both components to be partially submitted, nothing changes. Still both validators are called if one component value is changed. How can I prevent the whole form from being validated until it is submitted completely?

    Read the article

  • Email Validation from WTForm using Flask

    - by lost9123193
    I'm following a Flask tutorial from http://code.tutsplus.com/tutorials/intro-to-flask-adding-a-contact-page--net-28982 and am currently stuck on the validation step: The old version had the following: from flask.ext.wtf import Form, TextField, TextAreaField, SubmitField, validators, ValidationError class ContactForm(Form): name = TextField("Name", [validators.Required("Please enter your name.")]) email = TextField("Email", [validators.Required("Please enter your email address."), validators.Email("Please enter your email address.")]) submit = SubmitField("Send") Reading the comments I updated it to this: (replaced validators.Required with InputRequired) (same fields) class ContactForm(Form): name = TextField("Name", validators=[InputRequired('Please enter your name.')]) email = EmailField("Email", validators=[InputRequired("Please enter your email address.")]), validators.Email("Please enter your email address.")]) submit = SubmitField("Send") My only issue is I don't know what to do with the validators.Email. The error message I get is: NameError: name 'validators' is not defined I've looked over the documentation, perhaps I didn't delve deep enough but I can't seem to find an example for email validation.

    Read the article

  • asp:Validator in invisible elements + invisible targets

    - by Richard Neil Ilagan
    Somewhat straightforward: will asp:Validators still perform validation when they're in invisible containers? How about if their ControlToValidate target is invisible? For example: <asp:Panel id="myPanel" runat="server" visible="false"> <asp:Textbox id="myTextbox" runat="server" /> <asp:RequiredFieldValidator id="myRfv" runat="server" controltovalidate="myTextbox" /> </asp:Panel> Above is a Validator in an invisible Panel. Would myRfv still perform validation? How about if myTextbox is invisible instead? I'm asking this because I have very specialized Validators in my ASPX, wherein I also have Panels which are hidden/shown dynamically. While I'm all for disabling the validators themselves, I'm just curious whether they'll automatically disable anyway. Thanks guys! :D

    Read the article

  • ZF: How can I modify the error message for the required / notempty validator in the ini file

    - by heininger
    I'ld like to configure my forms using config with an ini file. I need individualized error messages like the following one: suche.elements.methode.options.validators.strlen.options.messages.stringLengthTooLong = "Der Suchbegriff '%value%' ist zu lang!" This works well for strlen and regex, but how do I set it up for "required" elements? I tried stuff like suche.elements.methode.options.validators.notempty.options.messages.isEmpty = "Der Suchbegriff darf nicht leer sein!" but this throws exceptions.

    Read the article

  • Online validators, syntax checkers, testing tools

    - by Max Gontar
    I often need to verify some simple code before posting, and it's great if I have installed IDE, but what if not? It would be nice to have online free tools for SQL, VB.NET, C# code validation, or maybe even testing. EDIT What I actually mean are online live web tools, like JSLint for javascript. Have you seen any?

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >