FAQ Database Discussion Community


What is a reliable isnumeric() function for python 3?

python,regex,validation,python-3.x,isnumeric
I am attempting to do what should be very simple and check to see if a value in an Entry field is a valid and real number. The str.isnumeric() method does not account for "-" negative numbers, or "." decimal numbers. I tried writing a function for this: def IsNumeric(self,...

Create data validation list when some of the values have commas?

excel,vba,validation,excel-vba
I am creating a data validation list using the following method: sDataValidationList = sDataValidationList & wksCalculation.Cells(r, lActivityNoColumn).value & "," Then I apply it to a cell using: .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=s This works well most of the time, but when any of the wksCalculation.Cells(r, lActivityNoColumn).value contain commas, then those...

XML validation: why is explicitly specifying a namespace not allowed in this case?

xml,validation,xsd,xml-namespaces
Given the following XSD: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:foo="urn:foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:foo" version="3.0"> <xsd:complexType name="Something"> <xsd:sequence> <xsd:element name="Nested" type="foo:NestedType"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="NestedType" /> </xsd:schema> The following XML is valid: <ns:Something xmlns:ns="urn:foo" xsi:type="ns:Something"...

Validator regex pattern input accept only a number with 2-5 digits

regex,validation,jsf
I want to validate user's input data with a custom Validator in a JSF application. The data inserted must be a number between 2 and 5 digits. Facelet <h:inputText id="num1" label="num1" required="true" size="5" maxlength="5" styleClass="#{component.valid ? '' : 'validation-failed'}" value="#{sumaManagedBean.number1}" requiredMessage="You must enter a value"> <f:validator validatorId="validators.NumberValidator"/> </h:inputText> <h:message for="num1"...

Restrict angular form submit on mobile

angularjs,validation
I have HTML form with angular validation and it shouldn't be submitted unless $valid form state is true. <form name="searchForm" action="/Search" method="get" novalidate> <input name="keywords" required type="search" ng-model="form.keywords"> <button type="submit" ng-disabled="searchForm.$invalid">Go</button> </form> ng-disabled directive prevents from submitting invalid form for desktop or mobile emulator. But if I use screen keyboard...

Xamarin MvvmCross ViewModel Validation

validation,mvvm,xamarin,mvvmcross
I'm building my first Xamarin MvvmCross application at the moment and I'm currently looking at validating user input to the view models. Doing a lot of searching around everything (including the MvvmCross team) link to this plugin: MVVMCross.Plugins.Validation This plugin makes use of a very old version of MvvmCross v3....

Check if the number entered is in array, otherwise add to the array

java,arrays,validation,input,user
The user will enter the size of the array and its values. If the entered value exists, the user must enter a different number. I can't seem to construct the proper code to check if the inserted value exists. public static void main(String[] args) { String holder="", s; int size;...

how to multiply two column names using codeigniter validation rule

php,codeigniter,validation
I have three columns.The product of two columns get into third column name income_amount using codeigniter validation rule.the first column is crop_quantity and the second is per_rate controller $this->form_validation->set_rules('crop_quantity', 'Crop Quantity', 'required|numeric'); $this->form_validation->set_rules('per_rate', 'Per Rate', 'required|numeric|callback_get_product'); $this->form_validation->set_rules('income_amount', 'Income Amount', 'required|numeric');...

how to get validated the associated attributes? rails4

ruby-on-rails,validation
I am using rails4. I have a model, lets say human. Human has nested model Man. Man has attributes Name, Address, Number. I am trying to make an api in which i am not able to validate associated attributes. I was able to validate the man by using validates_associated, But...

“Validation error: PayPal currencies do not match” in WooCommerce

wordpress,validation,paypal,woocommerce,currency
Using WooCommerce and the standard PayPal gateway to accept payments. When testing in Sandbox mode, everything works great. When we test live with a real transaction, payment goes through no problem, but within WooCommerce there is a note as follows: "Validation error: PayPal currencies do not match (code USD). Order...

Java - How to only create an object with valid attributes?

java,validation,object,constructor
I'm doing a basic Java course and I came to a problem: How do I create an object only if I have passed valid parameters to the Constructor? Should I make an alternate class and call the constructor from there after the validation is realized? Or should/could I use a...

Validation in JSF

java,regex,validation
I'm trying to implement the Validation of a form but it don't accept when I fill in numbers or characters. This is my login.xhtml <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:body>...

“This interface to HTML5 document checking is deprecated” - what's the meaning?

html,html5,validation,w3c-validation
I am doing one project, and as far as I am doing it I'm checking it for W3C errors (using html validator plug-in for Firefox), and in this process I found a warning that never showed up to me ever before. "Warning: This interface to HTML5 document checking is deprecated"...

Regex tom match percentage upto 2 decimal places

regex,validation
I need regular expression for percentage which satisfy following conditions. numbers between 0.1 to 100. Maximum up to 2 decimal place.It can accept up to one decimal place also like 0.1. Accept numbers up to 100 without decimal like 1,2,3----100. Can accept decimal without stating with 0 , like .11,.1,.2...

Regualr expression to check ip address with short mask

php,validation,ip-address
I want to validate an IP address with mask, like this: 192.168.32.4/24 but I only found how to validate an IP without the mask: 192.168.32.4 This is my code: $target = "192.168.34.12"; if (preg_match("/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $target)) { echo "correct"; } else { echo "incorrect"; } Thanks in advance. [Solved] $target =...

Multi-Culture Unobtrusive Validation Of Dates

javascript,jquery,asp.net,validation
I have an ASP.NET MVC project, and I'm using jquery.validate.unobtrusive to perform client side validation of values. However, I'm having issues validating dates. The system needs to support multiple cultures, however the majority of current users are from the UK, so use the UK date format. By default, this fails...

Symfony form dropdown for entries

php,forms,validation,symfony2
I am starting with coding in Symfony and I have the following problem: Assume I have two Entities 'Client' and 'Project'. They are stored with Doctrine. A Client has a Id, Name and an Email A Project has a Id, client_id, name So basically a project belongs to a Client...

Bean Validation message interpolation with array constraint parameter used as variable in message

java,validation,bean-validation
Is it possible to join the int array arguments in javax.validation error message interpolation? I want to validate a string for different possible lengths and I started implementing a custom constraint: @Constraint(validatedBy = {BarcodeValidator.class}) public @interface Barcode { String message() default "{validation.Barcode.message}"; int[] lengths(); } The validator: public class BarcodeValidator...

FluentValidation - How to customize the validation message in runtime

c#,validation,message,fluentvalidation
In this entity: public class Foo { public Guid Id { get; set; } public string Type { get; set; } public string Name { get; set; } } How can I customize the validation message in runtime using another property of entity or any other string obtained from the...

Correct PHP contact form syntax? [duplicate]

php,forms,validation
This question already has an answer here: PHP: “Notice: Undefined variable” and “Notice: Undefined index” 11 answers I am trying to follow a PHP contact form tutorial from here! Seems pretty simple and I'm completely new to PHP. However, when running my project, I get so many "Notice" messages...

How access element attribute inside Parsley Validation

validation,parsley.js
I need get attributes of element inside Parsley validation, I can using jQuery and selector, but I think it not the best way, have another way to do it? See below my validation and html code: (function () { 'use strict'; // Validate xml extension. window.ParsleyValidator.addValidator('filetype', function (value, requirement) {...

how to use validationResover

validation,typo3-flow
Like shown here I want to use the validationResolver to dynamically validate user inputs in my App. Therefore I want to proove, if a condition is true in my controller. If the condition is true, I want to validate with an own validator. For that I tried that: public function...

Is there a shorter/better way to validate request params?

python,validation,python-2.7,flask,werkzeug
I keep repeating blocks like this to validate request params. Is there a shorter/better way to implement this? count = request.args.get('count', DEFAULT_COUNT) if count: try: count = int(count) except ValueError: count = DEFAULT_COUNT ...

How do I submit a real-time validated form with Semantic UI and Meteor?

javascript,forms,validation,meteor,semantic-ui
I have run into a huge problem with my form, which I validate in real time using Semantic UI. The HTML: <form class="ui form pin-form"> <div class="field"> <label>Email</label> <input placeholder="[email protected]" name="email_input" type="text"> </div> <div class="ui buttons"> <input type="submit" class="ui submit positive disabled button login-button" value="Log in"> </div> </form> I added...

Cannot set property 'innerHTML' of null Javascript validation

javascript,validation,null
I get in the console a error of Cannot set property 'innerHTML'of null, how can i fix that the text after document.getElementById won't flash away after 1 sec. I added HTML code now, but when i want to post the button i only want to submit the form when everything...

Dynamic annotation/attribute values

c#,validation,annotations,attributes
I run into a problem using data annotations in c#. I am using custom required and range attributes and I want to set an object as the error message. [MyOwnRequired(ErrorCode=GlobalMessages.Message01] public string Description { get; set; } The problem is that I do have a class holding several objects (GlobalMessages.Message01,...

In CodeIgniter 2.2.0, why does the form validator not invoke my custom validation routine on array input data?

php,codeigniter,validation,codeigniter-2,codeigniter-form-helper
Here's the situation: While building a project in CodeIgniter 2.2.0, I was attempting to validate a tabular form with a custom data validator. The tabular form was set up to transmit POST data to the server in standard array format, and I was using non-zero based numeric keys. My keys,...

JavaScript/HTML onSubmit=“return Validation()” issue

javascript,html,validation,onsubmit
I have been searching for quite some time now, and have tried many alterations to my code, but can't seem to find an answer to my issue specifically. What I am trying to do: I have created a web page geocoder that takes an address, geocodes it, allows the user...

JavaScript validation on name field not working

javascript,forms,validation
I am trying to make my form validation work but I somehow can't make my name field to validate properly. When I write names in the field it will say that I need to write a proper name. What am I doing wrong? HTML: http://pastebin.com/EfNSkQkS JavaScript: http://pastebin.com/c6iUCYvr

How to use javascript to validate the input field for restricting numbers only and setting the range as maximum and minimum

javascript,html,angularjs,forms,validation
On event change the overflow value must get rejected. I have an input box in my form, where I want to restrict the user to enter only the numbers between 0 and 99999 only. But I don't want to disable the tab button functionality. The below code is working fine...

Can't validate a form in Bootstrap Modal using JavaScript

javascript,jquery,forms,validation,bootstrap-modal
Using the code below I send an email, but if I leave the inputs blank it sends it anyway. I want to validate the form before sending it, to make sure that they are not blank. j( document ).on( "submit", ".form-horizontal", function() { j.post(this.action, j(this).serialize(), function(){ //this callback is executed...

C# Validate DataSet filled with DGV data as XML

c#,xml,validation,datagridview,xsd
I want to make a "Save as" button which will validate data from dataGridView with .xsd XML schema before saving it as an XML file. The idea was to save DataTable filled with DGV data as an XML, validate it with .xsd and delete it if the file is valid...

Input validation setTimeout in ReactJS

javascript,css,validation,reactjs,ecmascript-6
I have a component that renders with className="error" or classname="" depending on whether the input is valid or not. This way in CSS I can simply do .error { background: red; }. The validity of the input is determined by the isValidNumber(..) function. However, right now the problem I'm having...

Using JavaScript or JQuery to clear a file upload field if the file selected is not a certain type [duplicate]

javascript,jquery,html,validation,file-upload
This question already has an answer here: Limit file format when using <input type=“file”>? 8 answers I have essentially re-skinned a file-upload form field. <input id="uploadFile" placeholder="Choose File" disabled="disabled" /> <div class="fileUpload btn btn-primary"> <span>Upload</span> <input id="uploadBtn" type="file" class="upload" /> </div> .fileUpload { position: relative; overflow: hidden; margin: 10px;...

RegEx conversion to use with Javascript

javascript,regex,validation
I'm currently using this RegEx ^(0[1-9]|1[0-2])/(19|2[0-1])\d{2}$ in .NET to validate a field with Month and Year (12/2000). I'm changing all my RegEx validations to JavaScript and I'm facing an issue with this one because of /in the middle which I'm having problems escaping. So based on other answers in SO...

how can I return the validation errors for a REST call?

validation,cakephp-3.0
I am making a REST api for my application. It almost works, but I want it to return the validation errors when they occurs. With CakePHP 2.x I see there was an invalidFields method, but it's not there anymore with Cake3. I see, instead, that there is an errors method...

jQuery Code not updating after validation

javascript,jquery,validation,input
I am making a url shortening website and I have some jQuery code that checks the url input and validates it every time the user makes any changes. If it is valid, the field turns green, if not, it stays red until it turns green. It works fine there, but...

Is there a way to override default CSS of HTML5 form validation messages

css,html5,validation,background
I want to change background of bubble message - to be red and text to be in another language , not english. I've set "required" to my input fields and CSS for valid and invalid and it's working. And how to make this bubble message to appear when you hover...

multiple type of Validation through javascript

javascript,validation
i want to validate the text filed and multiple radio button field through the javascript.here is the form code: <!DOCTYPE html> <html> <head> <title>script</title> <script type="text/javascript" src="script.js"></script> </head> <body> <form name="myForm"> <table> <tr> <td> <input type="text" name="job_id" placeholder="*Booking/Job Id no : " > </td> <td> <input type="text" name="taxi_id" placeholder="* Driver...

MS Access validation rules not firing in subform

vba,validation,ms-access,access-vba,ms-access-2013
I have a datagrid that is a subform inside another form. I need to validate items inputted into this datagrid subform, but I'm having an excruciatingly hard time figuring out how. Whenever I read about this on forums and on Microsoft's help site, they recommend you use Required and Validation...

Rails 4 validation conditional on value of a hidden field

ruby-on-rails,validation,conditional,hidden-field
How can I perform a validation only if the value of a hidden_field matches a specified value? For example, I have two forms each with a separate submit button and a separate hidden_field, the value of which determines whether to run one set of validations or another. The problem seems...

How to perform XML Validation when using ModelDriven?

java,xml,validation,struts2,model-driven
I've created a Struts2 project in which I used XML based validation. Model class RegistrationForm is shown below package com.projects; import com.opensymphony.xwork2.ActionSupport; public class RegistrationForm implements Serializable{ private static final long serialVersionUID = 1L; private String fname; private String lname; private int numbr; public int getNumbr() { return numbr; }...

Oracle regular expression REGEXP_LIKE for multiple columns

sql,regex,oracle,validation,if-statement
I want to validate TAX , NAME, TELEPHONE NO . Those are should be alpha-numeric.So used this method but in here i want to know can i do this same by short method in simply way without using so many "AND" s. IF REGEXP_LIKE(i.TAX, '^[A-Za-z0-9]+$') AND REGEXP_LIKE(i.NAME, '^[A-Za-z0-9]+$') AND REGEXP_LIKE(VarTelephone...

How to validate in database for uniqueness?

ruby-on-rails,validation,ruby-on-rails-4
I am using Rails 4.2 with Ruby 2.1.5. Here is my API table: create_table "apis", force: :cascade do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" t.string "status" t.string "coname" end How do I validate that a user cannot create an API with the same name and same status twice? For...

How to conditionally invoke spring validators

java,spring,validation
I have a model like below. Existing code already has validations on individual properties. Now I have a requirement to ignore existing validations on billing_country and address if buyer.method is foo. I was thinking I could have a custom validator at buyer level, check for method and invoke validations only...

angular validation not working on select

javascript,angularjs,validation
its a simple form a drop down and a save button. On page load Select should be ng-invalid because it is required and nothing is selected but form and select both are ng-valid and save function is called. and once i select any thing and un select it. then it...

vertical bar chart with validation

javascript,html,validation,charts
I changed my code abit, because i want some validation inside my code. before the the bars had the "%" on it and the name typed in under the bar, now if i type in 2 participants, it creates 4 bars instead of 2. At the place where the names...

MVVM - Validating the model when a field in the viewmodel is changed

c#,wpf,validation,mvvm,ef-database-first
I'm using the MVVMLight libraries with a Database-First EF model. I can't quite figure out how to validate the model when a certain field in my viewmodel has changed. This works fine when I'm updating individual Properties of the model as I have a call to Validate in the set...

javax.validation How get property name in a validation message

java,validation
I'm lookin for some proper way to use property name inside validation messages, like {min} or {regexp}. I've googled this question a few times and apearently there isn't a native method for doing this. @NotNull(message = "The property {propertyName} may not be null.") private String property; Did some one can...

How can validate only a certain fields in php Laravel 5?

php,validation,laravel,laravel-5
I'm currently working on my Edit form in my Laravel application. I request all the inputs from a form submit. I got : array:6 [▼ "_method" => "PUT" "_token" => "iWyonRYFjF15wK8fVXJiTkX09YSPmXukyGbBcHRA" "phone" => "9786770863" "email" => "[email protected]" "address" => "23 School St Lowell MA 01851" "$id" => "1" ] My...

JSON (schema) validation with escaped characters in patterns fails

json,validation,escaping
The following JSON object is valid: { "foo": "bar", "pattern": "^(\/?[-a-zA-Z0-9_.]+)+$" } Whereas this one is not: { "foo": "bar", "pattern": "^(\/?[-a-zA-Z0-9_.]+)+\.jpg$" } It's the escaped dot (\.), but I can't see why this should not be valid JSON. I need to include such patterns in my real JSON schemas....

HTML vs. JavaScript form validation [duplicate]

javascript,jquery,html,html5,validation
This question already has an answer here: JavaScript: client-side vs. server-side validation 11 answers I am new to front end web development and am making a small application where I want to validate that the user has in fact entered a valid URL. At first thought I figured I...

check existence of data in python dictionary

python,validation,dictionary,key
I have a program that maintains a flat file database of cd information. I am trying to write a function that updates the database. In this function I am checking to see if the artist exists and if so, appending the album name to this artist, but for some reason...

Validating currency allows more than two decimal places [duplicate]

c#,winforms,validation,currency,tryparse
This question already has an answer here: Find number of decimal places in decimal value regardless of culture 8 answers Situation: I'm writing a Winforms app using C# in VS2013 with .NET4.0. Some cells in a datagridview need to be validated as correctly formatted UK currency values. The dgv...

Struggling with PHP validation

php,jquery,html,twitter-bootstrap,validation
I have some previous experience in Python programming, but i was asked to build a web page for someone so i have tried to build a basic page using a bootstrap framework, html and php (Learning as a went along). Everything seemed to be exactly as needed appart from the...

Validation of a form before submission

php,validation,symfony2,form-submit
Using Symfony, version 2.3 and more recent, I want the user to click on a link to go to the edition page of an already existing entity and that the form which is displayed to be already validated, with each error associated to its corresponding field, i.e. I want the...

How to avoid Hibernate Validator ConstraintDeclarationException?

java,spring,hibernate,validation,hibernate-validator
I have my WebService based on Spring 4, and I am using Hibernate Validator (beyond MethodValidationPostProcessor). My problem is that I have my ClientService interface, and its implementation. So I put Bean Validation constraints on the implementation and it forces me to put that constraints on the interface (throwing ConstraintDeclarationException)...

Yii2 required validation on update

php,validation,yii2
I've Yii2 form containing form fields depending on action of page. Ex. Few fields appears when then action is create and few appears when action is update. I want to add required validation based on this scenario. Ex. <?= $form->field($model, 'unique_identifier')->textInput(['maxlength' => 45]) ?> I am showing this field only...

How to successfully implement WPF textbox validation?

c#,wpf,validation,xaml,visual-studio-2012
I'm trying to implement what should be simple textbox validation for a WPF application, but I'm having some problems. I used this guide: http://www.codeproject.com/Tips/690130/Simple-Validation-in-WPF My textbox in MainWindow.xaml: <TextBox x:Name="textbox1" HorizontalAlignment="Left" Height="23" Margin="93,111,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Style="{StaticResource textBoxInError}" Validation.ErrorTemplate="{StaticResource validationErrorTemplate}"> <TextBox.Text> <Binding Path="Name"...

How to make text field compulsory only when the checkbox is checked with symfony annotation validations in model classes

validation,symfony2
It is probably a very simple question but I've run out of juice here. Vat field is compulsory only when isVatable checkbox is check by user otherwise it can be ignored. How do I achieve this with group validation (annotations) in model class, not entity? I checked Validation Groups and...

Implementation of IDataErrorInfo, excessive use of if-statements

c#,entity-framework,validation,mvvm-light
I can't really think of a better way to word my title and it's probably the most accurate description of what I've just done. This question is a mix of best practices and coding style. I've basically got a WPF application that uses the MVVMLight libraries and Entity Framework (6.x)...

Django form for querying database. Is form.py needed and how to leave fields empty for query?

forms,validation,python-3.x,django-forms
I would like to have an input form where a user inputs either an incident_id or a equipment_id or both. The problem I have now is for example, if I fill in incident_id and leave equipment_id blank, the query will return no hits even when incident_id finds a match, because...

Validation on other when more than one checkbox is checked

javascript,jquery,validation,checkbox
I have a form that has series of checkboxes. When the other checkbox is selected an alert appears if you don't fill in the other textbox. If I select more than one checkbox it doesn't validate at all? <form> <div id="form-2" class="pages active" data-page="form-2" style="display: block;"> <p>Please indicate below the...

MVC 5 - Validate a specific field on client-side

javascript,jquery,asp.net-mvc,validation,asp.net-mvc-5
I want to populate a city/state drop down list based on the postal code a user types into a textbox. So when the text changes, I'm going to make an ajax call to retrieve the data. However, I only want to perform that ajax request for valid postal codes. The...

Javascript/jQuery form validation

javascript,jquery,forms,validation
I got most of this form validation to work properly but the only issue is that when the form detects an error on submit and the user corrects the mistake, the error text won't go away. This can be confusing for the user but I can't seem to figure out...

When pushing a button inside a partial view, parent form is validated

asp.net-mvc,validation,asp.net-mvc-5
In a MVC 5 application, I have a partial view with a button to submit some information. But when I push that button the parent form is validated, making all the validating errors displayed. All I want is that only the validated fields in the partial view are executed with...

How to validate only after leaving focus of paper-input (Polymer 1.0)

validation,focus,polymer
I'm trying to get Polymer to only validate input for my paper-input once I leave the focus of the textbox. Here's a bit of code I have below: <paper-input label="ZIP Code:" auto-validate pattern="\d{5}([-]\d{4})?" error-message="Invalid ZIP Code"></paper-input> The above code works great at live validation and the regex allows the format...

Validation of text fields and contact no text field

java,swing,validation,textfield
I have a JFrame consisting of some text fields (10) and a TextArea. I want to validate all the text fields and see if they are not empty and also check if a 10 digit contact no is entered in one of the text field. After checking the text fields,...

mvc 4 custom format validator does not show error and allows the form to submit

asp.net-mvc,validation,asp.net-mvc-4
I have the following validator for a MVC 4 view public class IpFormatValidator: ValidationAttribute { protected override ValidationResult IsValid(object value, ValidationContext validationContext) { ValidationResult resp; if (value != null) { string ip ; IPAddress noUsed ; ip = value.ToString(); if(IPAddress.TryParse(ip, out noUsed)) { resp = ValidationResult.Success; } else { resp...

Codeigniter Form Validation Rule for match (password)

php,forms,codeigniter,validation
I am trying to write Form validation rules in my Controller to submit Change Password form in which I am checking the old password too. I am getting the old password(current) from db and placing it in a hidden input field. My Rules are simple and are given below $config=array(...

Validation on Radio Buttons

c#,wpf,validation,data-binding,radio-button
I'm not really sure how to word this, so here goes. I've got some radio buttons on a form in my WPF application which get validated. They're basically a required field for this form. When I start to fill in the form, both radio buttons are marked with a red...

vertical bar chart with with user input and validation

javascript,html,validation,charts
i need a make a code where the user can add the max points, achieved points and his name. this is my code..most things are already working, i just need a function to change the max points, right now its a static number. <head> <title>examAnalysis</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" />...

Enum validation in Rails 4.2 doesn't work

ruby-on-rails,validation,enums
My User model looks similar to this: class User < ActiveRecord::Base enum type: [:admin, :reviewer, :super_admin ] validates :type, presence: true validates :type, inclusion: { in: User.types.keys } end When I submit anything outside the enum values, the validation doesn't stop the code from running, and I get a 500...

Manually highlight all invalid inputs of Angular Form

javascript,angularjs,forms,validation
The task is kinda primitive. I got a simple Angular form with various inputs and I'd like to highlight invalid inputs manually (e.g. on submit action). I tried to loop over invalid inputs, assuming that they must have some method to highlight an error, but unfortunately they don't. Same with...

Symfony2 form builder without class check if multiple fields are empty

validation,symfony2,constraints,formbuilder
I am using form builder without class and have two fields with each having constraints : $form = $this->createFormBuilder() ->add('name', 'text', array( 'required'=>false, 'constraints'=> new Length(array('min'=>3) )) ->add('dob', 'date', array( 'required'=>false, 'constraints'=> new Date() )) ->getForm() ->handleRequest($request); This works great but I want to check if both fields are emtpy,...

password check directive elem.add error

javascript,angularjs,validation,events,angularjs-directive
I'm making a password checking directive to ensure password and confirm_password fields are the same: angular .module('myModule') .directive('pwCheck', function() { return { require: 'ngModel', link: function (scope, elem, attrs, ctrl) { var password = "#" + attrs.pwCheck; elem.add(password).on('keyup', function() { scope.$apply(function () { ctrl.$setValidity('pwmatch', elem.val() === $(password).val()); }); }); }...

CSLA How to validate StartDate and FinishDate?

c#,validation,csla
I'm new to CSLA , and I've started learning about validation.I have one simple form Form1 containing datagridview1 and in Column2 and Column3 StartDate and FinishDate are shown.My idea is to useErrorProvider in this WinForm and make some validation rule like this StartDate < FinishDate and forbid saving object to...

How to make a valid
  • link
  • html,css,validation
    I'm trying to make an unordered list where the list items are links, not just the text inside them. But this is not valid. When checking my code with https://validator.w3.org/check I receive the message Element a not allowed as child of element ul in this context. This is the code:...

    How to check for initial spaces in the text entered in edit text android

    android,validation,android-edittext
    I have an issue in validating edit text in my android application. I have tried many methods and none of them are suiting my scenario. When user tries to save the post the entering only spaces in edit text field I need to pop out an error message. But I...

    How to validate same, repeated capital and lowercase character in a string?

    c#,string,validation
    I have two problems with this code (that I can see - ;^): 1) when if condition one is not met, both validation message boxes show; I only want one or the other to display given the conditions in each if block. 2) how can I validate (if block two)...

    Seeding fails validation for nested tables (validates_presence_of)

    ruby-on-rails,ruby,validation,ruby-on-rails-4,associations
    An Organization model has a 1:many association with a User model. I have the following validation in my User model file: belongs_to :organization validates_presence_of :organization_id, :unless => 'usertype==1' If usertype is 1, it means the user will have no organization associated to it. For a different usertype the presence of...

    Validating IP never succeeds

    java,android,validation,ip,matcher
    The user enters an IP address in a EditTextPreference and I try to validate the IP with this code: private EditTextPreference ipPref; private Matcher matcher; private SharedPreferences settings; private final Pattern IP_ADDRESS = Pattern.compile( "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]" + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]" + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" + "|[1-9][0-9]|[0-9]))"); @Override public void onCreate(Bundle...

    spring mvc javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.String

    java,spring,validation,spring-mvc,hibernate-validator
    I try to use the validators for the first time with Spring MVC and I always get the exception: javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.String at org.hibernate.validator.engine.ConstraintTree.verifyResolveWasUnique(ConstraintTree.java:236) at org.hibernate.validator.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:219) at org.hibernate.validator.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:167) at...

    jQuery validate equalTo

    javascript,jquery,validation
    I would like to use jQuery validate() plugin using the equalTo to validate a signature field, basically the signature field must match the first name and last name field, is this possible using the validate() plugin? http://jqueryvalidation.org/equalTo-method/ shows me how to check if it is equal to another input, but...

    Veridis Biometrics SDK validating with strings

    .net,validation,biometrics
    I'm sorry to make a long introduction, but this is what I have done so far: Downloaded the SDK; Read the manual ; Followed the sample project they patched with the SDK. But, the thing is, I already had another biometric solution working and it used to save all hash...

    Validator EmailAddress can validate an array of email

    php,validation,email,zend-framework2,jquery-select2
    I have a select2 field (tags) wich need to be validated with EmailAddress validator from Zend framework 2. the post from select2 field is like this : [email protected], [email protected]' From here, my form has an input filter wich looks like this : public function getInputFilterSpecification() { return array( 'name' =>...

    Laravel 5 form request validation returning forbidden error

    php,validation,laravel,laravel-4,laravel-5
    I am trying to use Laravel 5.1's form request validation, to authorize if the request is from the owner. The validation is used when the user is trying to update part of the table clinics through the show.blade.php. My set up so far: routes.php: Route::post('clinic/{id}', array('as' => 'postUpdateAddress', 'uses' =>...

    FluentValidation NotEmpty and EmailAddress example

    c#,validation,refactoring,fluentvalidation
    I am using FluentValidation with a login form. The email address field is Required and Must be a valid email address. I want to display a custom error message in both cases. The code I have working is: RuleFor(customer => customer.email) .NotEmpty() .WithMessage("Email address is required."); RuleFor(customer => customer.email) .EmailAddress()...

    MVC HTML Helpers: Get all validation attributes

    c#,asp.net-mvc,validation,html-helper
    When it comes to making custom helpers, how can we get the value for the validation attributes (client-side validation)? for example the built in helpers do something like this: <label class="control-label " for="Starts">Starts</label> <span class="field-validation-valid text-danger" data-valmsg-for="Starts" data-valmsg-replace="true"></span> <input class="form-control text-box single-line" data-val="true" data-val-date="The field Starts must be a date."...

    Accessing the main object in a javax.validation.ConstraintValidator

    java,validation
    I'm trying to use the javax.validation framework for a all the web app's validation needs. In order to do this, I need to write some validators that access the main object being validated. For example, let's say my object has startDate and endDate and I need to validate to make...

    Verifying whether a decimal value is a valid [closed]

    ruby,string,validation
    I want to verify the numbers after a given decimal. Values above 10 should be considered as invalid. I would need a regex command to verify. For example: Input: Expected response 0.005: valid 1.003: not valid 1.04: valid I tried the following regex, but it doesn't give me the expected...

    How can I make a “*required field” error message appear for a drop down menu in a validating PHP form?

    php,forms,validation,drop-down-menu,server-side
    I created a form using PHP. The form needs to be validated and it works for every field but the "rate our site" drop down menu. I'm using the same code from the form from other questions (name, email, etc.) for the "rate our site" drop down menu but the...

    Cornice schema validation with colanderalchemy

    python,validation,sqlalchemy,pyramid,colanderalchemy
    Cornice's documentation mentions how to validate your schema using a colander's MappingSchema subclass. How should we use a colanderalchemy schema for the same purpose? Because if we create a schema using colanderalchemy as stated in the documentation, the schema object has already instantiated the colander's class, and I think that...

    How to validate non-db attributes on an ActiveRecord model?

    ruby-on-rails,validation,activerecord
    I have the following class: class Instance < ActiveRecord::Base attr_accessor :resolution validates_format_of :resolution, with: /\A\d+x{1}\d+\d/ def resolution=(res) validate! (set the resolution etc) end def resolution (get the resolution and return) end end The resolution attribute is not stored in the database, but is a transient property of the instance. When...

    Validate value of input with angularjs

    javascript,jquery,angularjs,validation
    I have a text input that pulls the value of the window.location.href, looks for ?= and strips out the trailing value which is used as the input value. I can't get the validation to check if there is a value after the =, and display an error if there isn't....

    How to change the message in buildRules [CakePHP 3]?

    validation,cakephp,cakephp-3.0
    The function below is for being sure the e-mail from form is unique, if it's already in use a message is showed. I want to change this message. public function buildRules(RulesChecker $rules) { $rules->add($rules->isUnique(['username'])); $rules->add($rules->isUnique(['email'])); return $rules; } I tried this way: public function buildRules(RulesChecker $rules) { $rules->add($rules->isUnique(['username'])); $rules->add($rules->isUnique(['email']), ['errorField'...

    Regular expression failing to validate xml against xsd

    regex,validation
    I'm trying to fix a bug in a xsd file that someone else has written years ago. The problem is that xml is not validating against the xsd. The error message returns following: "The value '0:0|-?\d{0,3}.*[0-9]+:-?\d{0,3}.*[0-9]+' of the facet 'pattern' is not a valid regular expression." "WXS schema fileName.xsd failed...

    Is there a way to Sanitize a number of variables at once?

    php,mysql,validation
    I am trying to sanitize 54 variables at once. Currently I am doing them one by one like so if($vissuedate != '') { $vissuedate = filter_var($vissuedate, FILTER_SANITIZE_STRING); if($vissuedate == ''){ $vvalidate++; } } I have a whole bunch more and want to ask if there is a way to validate...

    Regular expression to validate US phone number with Custom validations

    regex,validation
    I want to create regular expression to validate US phone numbers, which will validate below need: 333 (till 1 to 3 digits) 333-3 (3 digits + 1 hyphen + 1 to 3 digit) 333-333-3333 (3 digits + 1 hyphen + 3 digit + 1 hyphen + 1 to 4 digits)...

    Validate row with inputs in a table that has been built dynamically in AngularJS

    javascript,html,angularjs,validation,angularjs-ng-repeat
    I've been struggling on the solution to the following problem. I have a table in which every row is build dynamically by ngRepeat. Every row has four columns and in every column there is an input element. My question is - how can I validate these four input fields and...