Search Results

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

Page 16/107 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Validate Div tag seperately...

    - by Joby Kurian
    i have 3 div tags.Each having no. of textboxs and button.Each textbox having validation.For all button causesvalidation property is true.If i click "button1" in "div1" tag will cause validation of other textbox in other div tags.I dont want to do this ? How to avoid this?

    Read the article

  • How to validate inclusion of time zone?

    - by LearningRoR
    When I try: validates_inclusion_of :time_zone, :in => TimeZone validates_inclusion_of :time_zone, :in => Time.zone This error appears: "<class:User>": uninitialized constant User::TimeZone (NameError) I'm trying to let users select any time zone of the world but since I'm based in the U.S.A. my select menu is this: <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones, {:prompt => "Select Your Time Zone *"}, {:id => "timezone"} %> What's the correct way to do this? Thank you.

    Read the article

  • Best way to validate currency input?

    - by Abe Miessler
    I have created the TextBox and CompareValidator below which I thought would allow input in the following forms: 5 5.00 $5.00 Unfortunately it's not allowing the version with the dollar sign in it. What is the point of doing a type check against currency if you don't allow the dollar sign? Is there a way to allow this symbol? <asp:TextBox ID="tb_CostShare" runat="server" Text='<%# Eval("CostShare", "{0:$0.00}")%>' CausesValidation="true" /> <asp:CompareValidator ID="vld_CostShare" runat="server" ControlToValidate="tb_CostShare" Operator="DataTypeCheck" Type="Currency" ValidationGroup="vld" ErrorMessage="You must enter a dollar amount for 'Cost Share'." />

    Read the article

  • JavaScript regular expressions to validate string

    - by Activist
    I'm not that good with regular expressions... I need a JavaScript regular expression that will do the following: The string can contain letters (upper and lower case), but not punctuations such as éàïç... The string can contain numbers (0..9) anywhere in the string, except on the first position. The string can contain underscores (_). Valid strings: foo foo1 foo_bar fooBar Invalid strings: 1foo -- number as first character foo bar -- space föo -- punctuation ö Many thanks!

    Read the article

  • MVC Validator.TryValidateObject does not validate custom atrribute, validateAllProperties = true

    - by nealsu
    When calling Validator.TryValidateObject with validateAllProperties = true my custom validation attribute does not get triggered. The ValidationResult does not contain an entry for my erroneous property value. Below is the model, attribute and code used to test this. //Model public class Model { [AmountGreaterThanZero] public int? Amount { get; set; } } //Attribute public sealed class AmountGreaterThanZero: ValidationAttribute { private const string errorMessage = "Amount should be greater than zero."; public AmountGreaterThanZero() : base(errorMessage) { } public override string FormatErrorMessage(string name) { return errorMessage; } protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value != null) { if ((int)value <= 0) { var message = FormatErrorMessage(validationContext.DisplayName); return new ValidationResult(message); } } return null; } } //Validation Code var container = new Container(); container.ModelList = new List<Model>() { new Model() { Amount = -5 } }; var validationContext = new ValidationContext(container, null, null); var validationResults = new List<ValidationResult>(); var modelIsValid = Validator.TryValidateObject(container, validationContext, validationResults, true); Note: That the validation works fine and ValidationResult returns with correct error message if I use the TryValidateProperty method.

    Read the article

  • Validate format of email in rails.

    - by piemesons
    validates_format_of :email, :with => /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" + @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/, :message => "is missing or invalid" Please let me know where is the problem? Is regular expression is wrong?

    Read the article

  • Validate a statment from string in JAVA

    - by Adnan
    I have a string; String allIn = "(50 > 100) AND (85< 100)"; Now I need to evaluate if the conditions inside are TRUE or FALSE, how can I do it? In real the string will be a value from a field in my DB, where I will substitute different values and they will form a string as shown above.

    Read the article

  • Validate a string

    - by Activist
    I'm not that good with regular expressions... I need a JavaScript regular expression that will do the following: The string can contain letters (upper and lower case), but not punctuations such as éàïç... The string can contain numbers (0..9) anywhere in the string, except on the first position. The string can contain underscores (_). Valid strings: foo foo1 foo_bar fooBar Invalid strings: 1foo -- number as first character foo bar -- space föo -- punctuation ö Many thanks!

    Read the article

  • How to validate overlapping no in java

    - by anandhinaveen
    I Have dynamically render row. WE have fields like FROM TO. For eg: From TO 2 10, 2 3, 8 12 It cannot accept this combination row.. That means no number should be overlapping. For eg: From TO 2 10, 0 1, 11 12 This combination is allowed.the row may also increased. I need need to write a validation for this overlapping. Can any 1 help to solve this problem.

    Read the article

  • Validate authenticity of website owner

    - by Cyber Junkie
    Hello all! I'm planning to develop a web app where users will list their site/blog. When people submit their sites, how can I confirm that they are the owners of it? So for instance there is a user Mark who wants to submit someone else's website without their approval. I want to restrict Mark from doing so unless he is the actual owner. My idea was to do a comparison between the user's email domain and the website domain she/he wants to submit. If they match allow the user to submit the website. However most people don't register with their website domain address.. or perhaps I'll implement a Facebook connect in the future. What other methods would you suggest?

    Read the article

  • How to validate the radio button and checkbox?

    - by xasjaiod123
    For radio button: $(document).ready(function() { $('#select-number').click(function() { if ($('input:radio', this).is(':checked')) { return true; } else { alert('Please select something!'); return false; } }); }); It is working fine when no radio button is selected. But When I select the radio button and submit the form Then also it is giving me the alert message 'Please select something!' Is there any good tutorials available for validation using Jquery for newbie.

    Read the article

  • Validate NSString

    - by Chris
    I am validating an NSString to ensure that the string does not contain apostrophes. The code I'm using to do this is NSCharacterSet * invalidNumberSet = [NSCharacterSet characterSetWithCharactersInString:@"'"]; NSScanner * scanner = [NSScanner scannerWithString:string]; NSString * scannerResult; [scanner setCharactersToBeSkipped:nil]; [scanner scanUpToCharactersFromSet:invalidNumberSet intoString:&scannerResult]; if(![string isEqualToString:scannerResult]) { return 2; } Returning 2 represents an error. This code works, except for the case where the string is an apostrophe. To get around this issue, I added the following code above the preceding block. if([string isEqualToString:@"'"]); { return 2; } This code is evaluating to true, regardless of the input. I need to either prevent the first block from crashing with the input of ', or get the second block to work. What am I missing?

    Read the article

  • How to validate if an HTMLLIElement is hidden with jQuery

    - by Hanzel
    I'm iterating through a variable called content, it contains several HTMLLIElement objects. How can i use jQuery's or JavaScript's functions with this object?, what I'm trying to do is the kind of validation written in the commented code. $.each(content, function(index, value){ //if(!value.is(':hidden')){ console.log(index + ' : ' + value); //} }); What I'm getting is Uncaught TypeError: Object # has no method 'is' If I do value.getAttribute('style'); I get 'display: none;'

    Read the article

  • Using depends with the jQuery Validation plugin

    - by Glenn Slaven
    I've got a form with a bunch of textboxes that are disabled by default, then enabled by use of a checkbox next to each one. When enabled, the values in these textboxes are required to be a valid number, but when disabled they don't need a value (obviously). I'm using the jQuery Validation plugin to do this validation, but it doesn't seem to be doing what I expect. When I click the checkbox and disable the textbox, I still get the invalid field error despite the depends clause I've added to the rules (see code below). Oddly, what actually happens is that the error message shows for a split second then goes away. Here is a sample of the list of checkboxes & textboxes: <ul id="ItemList"> <li> <label for="OneSelected">One</label><input id="OneSelected" name="OneSelected" type="checkbox" value="true" /> <input name="OneSelected" type="hidden" value="false" /> <input disabled="disabled" id="OneValue" name="OneValue" type="text" /> </li> <li> <label for="TwoSelected">Two</label><input id="TwoSelected" name="TwoSelected" type="checkbox" value="true" /> <input name="TwoSelected" type="hidden" value="false" /> <input disabled="disabled" id="TwoValue" name="TwoValue" type="text" /> </li> </ul> And here is the jQuery code I'm using //Wire up the click event on the checkbox jQuery('#ItemList :checkbox').click(function(event) { var textBox = jQuery(this).siblings(':text'); textBox.valid(); if (!jQuery(this).attr("checked")) { textBox.attr('disabled', 'disabled'); textBox.val(''); } else { textBox.removeAttr('disabled'); textBox[0].focus(); } }); //Add the rules to each textbox jQuery('#ItemList :text').each(function(e) { jQuery(this).rules('add', { required: { depends: function(element) { return jQuery(element).siblings(':checkbox').attr('checked'); } }, number: { depends: function(element) { return jQuery(element).siblings(':checkbox').attr('checked'); } } }); }); Ignore the hidden field in each li it's there because I'm using asp.net MVC's Html.Checkbox method.

    Read the article

  • jquery mouseover/mouseout

    - by Hulk
    In the following code once the mouse out is done the mouse over again does not work ,what is the work around for this <!DOCTYPE html> <html> <head> <style> /* div { background:#def3ca; margin:3px; width:80px; display:none; float:left; text-align:center; }*/ </style> <script src="http://code.jquery.com/jquery-latest.min.js"></script> </head> <body> <div id="playControls" style="position:absolute; bottom:0px; left:0px; right:0px;color:blue;"> Mouse over me </div> <script> $(document).ready(function() { $("#playControls").mouseover(function () { alert('here'); $("div:eq(0)").show("fast", function () { /* use callee so don't have to name the function */ $(this).next("div").show("fast", arguments.callee); }); }); $("#playControls").mouseout(function () { alert('here'); $("div").hide(2000); }); }); </script> </body> </html>

    Read the article

  • jQuery addClass on $.post

    - by Tim
    I am basically trying to create a small registration form. If the username is already taken, I want to add the 'red' class, if not then 'green'. The PHP here works fine, and returns either a "YES" or "NO" to determine whether it's ok. The CSS: input { border:1px solid #ccc; } .red { border:1px solid #c00; } .green { border:1px solid green; background:#afdfaf; } The Javascript I'm using is: $("#username").change(function() { var value = $("#username").val(); if(value!= '') { $.post("check.php", { value: value }, function(data){ $("#test").html(data); if(data=='YES') { $("#username").removeClass('red').addClass('green'); } if(data=='NO') { $("#username").removeClass('green').addClass('red'); } }); } }); I've got the document.ready stuff too... It all works fine because the #test div html changes to either "YES" or "NO", apart from the last part where I check what the value of the data is. Here is the php: $value=$_POST['value']; if ($value!="") { $sql="select * FROM users WHERE username='".$value."'"; $query = mysql_query($sql) or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($query); if ($num_rows 0) { echo "NO"; } else { echo "YES"; } }

    Read the article

  • Get value of multiselect box using jquery or javascript

    - by Hulk
    In the code below, how to get the values of multiselect box in function val() using jquery or javascript. <script> function val() { //Get values of mutliselect drop down box } $(document).ready(function() { var flag=0; $('#emp').change(function() { var sub=$("OPTION:selected", this).val() if(flag == 1) $('#new_row').remove(); $('#topics').val(''); var html='<tr id="new_row" class="new_row"><td>Topics:</td><td> <select id="topic_l" name="topic_l" class="topic_l" multiple="multiple">'; var idarr =new Array(); var valarr =new Array(); {% for top in dict.tops %} idarr.push('{{top.is}}'); valarr.push('{{topic.ele}}'); {% endfor %} for (var i=0;i < idarr.length; i++) { if (sub == idarr[i]) { html += '<option value="'+idarr[i]+'" >'+valarr[i]+'</option>'; } } html +='</select></p></td></tr>'; $('#tops').append(html); flag=1; }); }); </script> Emp:&nbsp;&nbsp;&nbsp;&nbsp;<select id="emp" name="emp"> <option value=""></option> </select> <div name="tops" id="tops"></div> <input type="submit" value="Create Template" id="create" onclick="javascript:var ret=val();return ret;"> Thanks..

    Read the article

  • A potentially dangerous Request.Form value was detected from the client

    - by Dilse Naaz
    Hi I have one asp.net application, which has some problems while i am entering the special characters such as ": &#, " in the search box. If i enter this text in search box, i got the exception like this. A potentially dangerous Request.Form value was detected from the client (txtValue=": &#, "). then i searched on the net, i got one general solution for this that to set the validaterequest to false. But no changes has been made on my application. Please help me for solving this issue. Any response that would be appreciated.

    Read the article

  • I don't get Zend_Validate_Regex working

    - by poru
    Zend_Validate_Alpha doesn't fit 100% to that what I want and I don't get Zend_Validate_Regex working. I want that the validator just allows a-z/A-Z, 0-9, _ and -. I tried to add the following to one of my inputs: addValidator('Regex', true, array('pattern' => '/^[a-zA-Z0-9_-]/')) but for example abc§$%& is a valid input says the Zend Validator. What am I doing wrong?

    Read the article

  • Styling jQuery validation

    - by Steve
    When I have this, the div, which just has text in it, uses all the horizontal width it can, so there's trailing width after the text, which I can tell from the background color. errorElement: "div", errorPlacement: function(error, element) { error.insertBefore("#zzz"); When I use this, the width is the same as the text contained, but I cannot get each individual error (span) to be on a separate line via display: block. errorElement: "span", errorPlacement: function(error, element) { error.insertBefore("#zzz"); error.css("display", "block"); Is there another way to force a break on a span element?

    Read the article

  • jQuery Validation rule inner HTML

    - by Sam Zhou
    As we know, jquery.validation.js is very powerful. In common, we should define the rule in js first, and then apply to input element or form. I'd like to declare the rule inner HTML code, then validator to find and apply the rule. just as below: <input MaxLength="10" id="StrField" class="required" name="StrField" type="text" value="Test" /> I have used to rules: required MaxLength My question is all the rules in jquery.validation could be wrote in HTML tag using attribute, and where I could get the document? can the jquery.metadata help for this?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >