Search Results

Search found 2674 results on 107 pages for 'validate'.

Page 29/107 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Spring validation errors not displayed

    - by Art Vandelay
    I have the following situation. I have a validator to validate my command object and set the errors on a Errors object to be displayed in my form. The validator is invoked as expected and works okay, but the errors i set on the Errors objects are not displayed, when i am sent back to my form because of the validation errors. Validator: public void validate(Object obj, Errors err) { MyCommand myCommand = (MyCommand) obj; int index = 0; for (Field field : myCommand.getFields()) { if (field.isChecked()) { if ((field.getValue() == null) || (field.getValue().equals(""))) { err.rejectValue("fields[" + index + "].value", "errors.missing"); } } index++; } if (myCommand.getLimit() < 0) { err.rejectValue("limit", "errors.invalid"); } } Command: public class MyCommand { private List<Field> fields; private int limit; //getters and setters } public class Field { private boolean checked; private String name; private String value; //getters and setters } Form: <form:form id="myForm" method="POST" action="${url}" commandName="myCommand"> <c:forEach items="${myCommand.fields}" var="field" varStatus="status"> <form:checkbox path="fields[${status.index}].checked" value="${field.checked}" /> <c:out value="${field.name}" /> <form:input path="fields[${status.index}].value" /> <form:errors path="fields[${status.index}].value" cssClass="error" /></td> <form:hidden path="fields[${status.index}].name" /> </c:forEach> <fmt:message key="label.limit" /> <form:input path="limit" /> <form:errors path="limit" cssClass="error" /> </form:form> Controller: @RequestMapping(value = REQ_MAPPING, method = RequestMethod.POST) public String onSubmit(Model model, MyCommand myCommand, BindingResult result) { // validate myCommandValidator.validate(myCommand, result); if (result.hasErrors()) { model.addAttribute("myCommand", myCommand); return VIEW; } // form is okay, do stuff and redirect } Could it be that the paths i give in the validator and tag are not correct? The validator validates a command object containing a list of objects, so that's why i give a index on the list in the command object when registering an error message (for example: "fields["+index+"]".value). Or is it that the Errors object containing the errors is not available to my view? Any help is welcome and appreciated, it might give me a hint or point me in right direction.

    Read the article

  • A solid nickname regexp

    - by iBram
    I want a regular expression to validate a nickname: 6 to 36 characters, it should contain at least one letter. Other allowed characters: 0-9 and underscores. This is what I have now: if(!preg_match('/^.*(?=\d{0,})(?=[a-zA-Z]{1,})(?=[a-zA-Z0-9_]{6,36}).*$/i', $value)){ echo 'bad'; } else{ echo 'good'; } This seems to work, but when a validate this strings for example: 11111111111a is not valid, but it should aaaaaaa!aaaa is valid, but it shouldn't Any ideas to make this regexp better?

    Read the article

  • How to handle input and parameter validation between layers?

    - by developr
    If I have a 3 layer web forms application that takes user input, I know I can validate that input using validation controls in the presentation layer. Should I also validate in the business and data layers as well to protect against SQL injection and also issues? What validations should go in each layer? Another example would be passing a ID to return a record. Should the data layer ensure that the id is valid or should that happen in BLL / UI?

    Read the article

  • Basic regexp help

    - by casben79
    I am new to programming PHP and am trying to validate a field in a form. The field if for a RAL color code and so would look something like : RAL 1001. so the letters RAL and then 4 numbers. Can someone help me set them into a regular expression to validate them. i have tried this with no success: $string_exp = "/^[RAL][0-9 .-]+$/i"; What can I say but sorry for being a complete NOOB at PHP. Cheers Ben

    Read the article

  • validation using jquery

    - by fusion
    i'm trying to validate an html page using jquery, but nothing happens. it's a simple page, yet the textboxes aren't validated. this is the code: <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="~/jquery.js/"></script> <script type="text/javascript" src="~/jquery-validate/jquery.validate.js/"></script> <script type="text/javascript"> $(document).ready(function(){ var validator = $("#submitForm").validate({ debug: true, rules: { author: "required", quote: "required" }, messages: { author: "Name of Author required" quote: "Please enter Quote" }, errorPlacement: function(error, element) { error.appendTo( element.parent().top() ); } ); }); </script> <body> <div class="container"> <div class="center_div"> <h2>Submit Your Quote</h2> <fieldset> <form id="submitForm" action="qinsert.php" method="post"> <div class="error" style="display:none"></div> <div class="field"> <label>Author: </label> <input name="author" type="text" class="required" minLength=3> <span class="error"></span> </div><br /> <div class="field"> <label>Quote: </label> <textarea name="quote" cols=22 class="required" minLength=5></textarea> <span class="error"></span> <br /> </div> <input id="button1" type="submit" value="Submit" class="submit" /><br /> <input id="button2" type="reset" value="Reset" /> </form> </fieldset> </div> </div> what is wrong with the code? thank you!

    Read the article

  • Iframe Facebook application and cookies [Internet Explorer]

    - by Joe P
    I have downloaded the IBM P3P editor, created files and uploaded them to my server. And cookies are still not recognized in Internet Explorer. I've checked the P3P validation tool and it seems to validate. The application can be viewed here: apps.facebook.com/naplesnews and the iframe points to www.naplesnews.com/facebook/app/. Again www.naplesnews.com/facebook/app/ seems to validate with no issues as well. Any idea what I'm missing here?

    Read the article

  • How do I run jQuery form validation by class?

    - by joshcomley
    Hi there, I've been using the jQuery form validator, but I can't seem to figure out how to trigger it by class. Take this example: $("#myform").validate({ rules: { field: { required: true, date: true } } }); Where field it is expecting the name of the particular input. But, what if I have the following: <input class="date".... /> How can I tell the validator to validate all inputs with a "date" class as a date?

    Read the article

  • CSS rgba Background Color Validation

    - by SHiNKiROU
    I found a weird CSS validation result: when rgba() is used to background, it does not validate, however, the workaround is rgba() for background-color. Why that rule exists? Is it a validator's bug? Try to validate the following there, and you can see the result: div { background: rgba(0, 0, 0, 0.5); } and div { background-color: rgba(0, 0, 0, 0.5); }

    Read the article

  • Need help with re for matching and getting the value python

    - by laspal
    Hi, Need help regarding re. file = 'file No.WR79050107006 from files' So what I am trying to do is validate if file string contains WR + 11 digit. result = re.match('^(\S| )*(?P<sr>(\d){11})(\S| )*', file) Its validate only 11 digit but not WR before it. How can I do that? Using re after matching how can I get the match value ( WR79050107006) I can do string find index = file.find('file No.') and then get the value of next 13 char. thanks

    Read the article

  • ssh-rsa public key validation using a regular expression.

    - by Warlax
    What regular expression can I use (if any) to validate that a given string is a legal ssh rsa public key? I only need to validate the actual key - I don't care about the key type the precedes it or the username comment after it. Ideally, someone will also provide the python code to run the regex validation. Thanks.

    Read the article

  • backbone model validation error

    - by koko
    I got a validation based on backbone fundamentals by addyosmani, but when i try it on my view i can't get the error that the model generated.TIA model.js validate: function(attrs) { var errors = this.errors = {}; if (!attrs.box) errors.box= 'box value is required'; //console.log(errors.box); if (!_.isEmpty(errors)) return errors; } view.js validate: function(model) { console.log("error text--" + model.errors[this.input] || ''); },

    Read the article

  • ASP.Net MVC Ajax form with jQuery validation

    - by Tomas Lycken
    I have an MVC view with a form built with the Ajax.BeginForm() helper method, and I'm trying to validate user input with the jQuery Validation plugin. I get the plugin to highlight the inputs with invalid input data, but despite the invalid input the form is posted to the server. How do I stop this, and make sure that the data is only posted when the form validates? My code The form: <fieldset> <legend>leave a message</legend> <% using (Ajax.BeginForm("Post", new AjaxOptions { UpdateTargetId = "GBPostList", InsertionMode = InsertionMode.InsertBefore, OnSuccess = "getGbPostSuccess", OnFailure = "showFaliure" })) { %> <div class="column" style="width: 230px;"> <p> <label for="Post.Header"> Rubrik</label> <%= Html.TextBox("Post.Header", null, new { @style = "width: 200px;", @class="text required" }) %></p> <p> <label for="Post.Post"> Meddelande</label> <%= Html.TextArea("Post.Post", new { @style = "width: 230px; height: 120px;" }) %></p> </div> <p> <input type="submit" value="OK!" /></p> </fieldset> The JavaScript validation: $(document).ready(function() { // for highlight var elements = $("input[type!='submit'], textarea, select"); elements.focus(function() { $(this).parents('p').addClass('highlight'); }); elements.blur(function() { $(this).parents('p').removeClass('highlight'); }); // for validation $("form").validate(); }); EDIT: As I was getting downvotes for publishing follow-up problems and their solutions in answers, here is also the working validate method... function ajaxValidate() { return $('form').validate({ rules: { "Post.Header": { required: true }, "Post.Post": { required: true, minlength: 3 } }, messages: { "Post.Header": "Please enter a header", "Post.Post": { required: "Please enter a message", minlength: "Your message must be 3 characters long" } } }).form(); }

    Read the article

  • Enterprise Library--Validator.cs How Abstract Class having definition??

    - by Soham
    Consider this piece of code: public abstract class Validator { protected Validator() { } protected abstract void ValidateCore(object instance, string value, IList<ValidationResult> results); public void Validate(object instance, string value, IList<ValidationResult> results) { if (null == instance) throw new ArgumentNullException("instance"); if (null == results) throw new ArgumentNullException("results"); ValidateCore(instance, value, results); } } TAKE a look at Validate() overload, how can an abstract class have definitions like this?

    Read the article

  • Python tkInter text entry validation

    - by meade
    I'm trying to validate the entry of text using Python/tkInter def validate_text(): return False text = Entry(textframe, validate="focusout", validatecommand=validate_text) where validate_text is the function - I've tried always returning False and always returning True and there's no difference in the outcome..? Is there a set of arguments in the function that I need to include? Edit - changed from NONE to focusout...still not working

    Read the article

  • help me understand the method Validator.TryValidateObject()

    - by Benny
    this is the method definition: public static bool TryValidateObject( Object instance, ValidationContext validationContext, ICollection<ValidationResult> validationResults, bool validateAllProperties ) what i am confused is the validateAllProperties parameter, I understand when it is true-validate all properties. What about when it is false, not validate all properties, but which property will be validated?

    Read the article

  • Date validation in PHP

    - by Rachel
    What would the regex expression that would go into preg_split function to validate date in the format of 7-Mar-10 or how can I validate a date of format 7-Mar-10 in PHP Thanks.

    Read the article

  • How the jQuery TinyMCE and jQuery RSV get to work?

    - by Trez
    I'm using RSV to validate form element, and tinymce to convert textarea to editor. The textarea is included to be checked by rsv validator using 'required', since the textarea is being converted to tinymce editor. Theres a problem on the validation, even i entered the value in the editor the validator says that textarea is a null. How can i validate the textarea using RSV? any ideas? Thanks in advance.

    Read the article

  • Digest authentication using LDAP only

    - by Elephant
    Is there a way to validate digest authentication using LDAP only? I.e. if I have the following request from a client (stealed from Wikipedia): GET /dir/index.html HTTP/1.0 Host: localhost Authorization: Digest username="Mufasa", realm="[email protected]", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", uri="/dir/index.html", qop=auth, nc=00000001, cnonce="0a4f113b", response="6629fae49393a05397450978507c4ef1", opaque="5ccc069c403ebaf9f0171e9517f40e41" could I validate the user against LDAP, meaning if I don't now user password hence is not able to construct a digest hash to compare with the response?

    Read the article

  • jQuery + Dialog Form Validation

    - by Panther24
    Hi, I have a jQuery Dialog form and on submit I'm trying to validate the fields. I'm using http://docs.jquery.com/Plugins/Validation to validate. In this I'm facing an issue, the validate function is not being called. I'm posting some snippet of my code $("#register-dialog-form").dialog({ autoOpen: false, height: 350, width: 450, modal: true, buttons: { 'Register': function() { $("#registerFrm").validate({ rules: { accountid: "required", name: { required: true, minlength: 5 }, username: { required: true, minlength: 5 }, password: { required: true, minlength: 5 } }, messages: { firstname: "Please enter your firstname", accountid: "Please enter the lastname", name: "Please enter a user friendly name", username: { required: "Please enter a username", minlength: jQuery.format("Enter at least {0} characters") }, password: { required: "Please provide a password", minlength: jQuery.format("Password must be at least {0} characters long") } } }); //****************** //TODO: Need to submit my form here //****************** $(this).dialog('close'); }, Cancel: function() { $(this).dialog('close'); } }, close: function() { //$('registerFrm').clearForm(); } }); Can someone please tell me what I'm doing wrong here. I've also tried to put the validation into $(document).ready(function() {}, but with no success. Here is the html code <div id="register-dialog-form" title="Register Account - Master" align="center" style="display: none"> <s:form name="registerFrm" id="registerFrm" action="registermaster" method="POST"> <table width="90%" border="0" class="ui-widget"> <tr> <td> <s:textfield label="Account Id" name="accountid" id="accountid" cssClass="text ui-widget-content ui-corner-all" /> </td> </tr> <tr> <td> <s:textfield label="Name" name="name" id="name" cssClass="text ui-widget-content ui-corner-all" /> </td> </tr> <tr> <td> <s:textfield label="Username" name="username" id="username" cssClass="text ui-widget-content ui-corner-all" /> </td> </tr> <tr> <td> <s:password label="Password" name="password" id="password" cssClass="text ui-widget-content ui-corner-all" /> </td> </tr> </table> </s:form> </div><!--End of RegisterAcc form-->

    Read the article

  • jQuery Validation Plugin: Packer undefined error?

    - by Rosarch
    I'm using the jQuery validation plugin from bassistance.de. It works fine. From <head>: <script type="text/javascript" src="/static/JQuery.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.validate.pack.js"></script> <script type="text/javascript" src="/static/js-lib/jquery.validate.additional-methods.js"></script> At first, this was the only validation code I had, and it worked: $("form").validate(); $("#form-username").rules("add", { required: true, email: true, }); It was validating this HTML: <form id="form-username-form" action="api/user_of_email" method="get"> <p> <label for="form-username">Email:</label> <input type="text" name="email" id="form-username" /> <input type="submit" value="Submit" id="form-submit" /> </p> </form> Great, everything works. But then I add this JS: $("#form-choose-options input[type='text']").rules("add", { number: true, }); to validate this markup: <form id="form-choose-options" action="api/set_options" method="get"> <p> <label for="form-min-credits">Min credits per term:</label><input type="text" name="min_credits" id="form-min-credits" /> <br /> <label for="form-optimal-credits">Optimal credits per term:</label><input type="text" name="optimal_credits" id="form-optimal-credits" /> <br /> <label for="form-max-credits">Max credits per term:</label><input type="text" name="max_credits" id="form-max-credits" /> <br /> <label for="form-low-GPA">Lowest acceptable GPA:</label><input type="text" name="low_GPA" id="form-low-GPA" /> <br /> <label for="form-high-GPA">Highest realistic GPA:</label><input type="text" name="high_GPA" id="form-high-GPA" /> <br /> <input type="hidden" class="user-pk" name="pk"/> <input type="submit" value="Submit" /> </p> </form> This causes a javascript error on document load: $.data(f.form, "validator") is undefined The error is from the packer function. What am I doing wrong?

    Read the article

  • Jquery validation on click event instead of on submit

    - by Mazzi
    I looked all around SOF but no luck to find me answer. It is either too easy or the answer is not just there. What I simply need to do is to validate the form when my <img id='submit'/> is clicked and submit it afterwards. $(document).ready(function(){ $('#submit').click(function() { }); // Validation $('#suzuki_scb').validate({ // My Rules and Messages! }); });

    Read the article

  • Step by Step validation with jquery validation plugin

    - by Alex
    I know its been asked many times already but no one could come up with solution so far. The idea is to have one form separated into few steps and validate each step on next click of the button. I know jquery validation plugin is offering quite complicated way of doing it with accordion but can anyone come up with a simple solution something like var stepOne = { rules: { fieldname1: "required", fieldname2: "required", } } $("form").validate(stepOne); //onclick hope someone could suggest the best way of doing it. Thanks.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >