Validation
The most awesome validation engine ever created for PHP
I am using eclipse on my project and while messing around with my eclipse settings, I turned on Javascript support. Now eclipse complains that JQuery library has errors in it and is not letting me compile the project. Does anyone know how to turn javascript validation off?
Source: (StackOverflow)
I am writing BBCode for my own forum (based on PHP). How do you find out if it is an invalid URL provided in the the [url]
tag? Which characters make a URL invalid?
To extend my main question, are these valid URLs?—
example.com/file[/].html
http://example.com/file[/].html
Source: (StackOverflow)
I'm generating xml files that need to conform to an xsd that was given to me. What's the best way to do this?
Source: (StackOverflow)
What is the best way to restrict "number"-only input for textboxes?
I am looking for something that allows decimal points.
I see a lot of examples. But have yet to decide which one to use.
Update from Praveen Jeganathan
No more plugins, jQuery has implemented its own jQuery.isNumeric() added in v1.7.
See: http://stackoverflow.com/a/20186188/66767
Source: (StackOverflow)
Is there an implementation of (or third-party implementation for) cross field validation in Hibernate Validator 4.x? If not, what is the cleanest way to implement a cross field validator?
As an example, how can you use the API to validate two bean properties are equal (such as validating a password field matches the password verify field).
In annotations, I'd expect something like:
public class MyBean {
@Size(min=6, max=50)
private String pass;
@Equals(property="pass")
private String passVerify;
}
Source: (StackOverflow)
Just looking at:
(Source: https://xkcd.com/327/)
What does this SQL do:
Robert'); DROP TABLE STUDENTS; --
I know both '
and --
are for comments, but doesn't the word DROP
get commented as well since it is part of the same line?
Source: (StackOverflow)
I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:
- 1-234-567-8901
- 1-234-567-8901 x1234
- 1-234-567-8901 ext1234
- 1 (234) 567-8901
- 1.234.567.8901
- 1/234/567/8901
- 12345678901
I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.
Source: (StackOverflow)
I have a form that I would like all fields to be filled in. If a field is clicked into and then not filled out, I would like to display a red background.
Here is my code:
$('#apply-form input').blur(function () {
if ($('input:text').is(":empty")) {
$(this).parents('p').addClass('warning');
}
});
It applies the warning class regardless of the field being filled in or not.
What am I doing wrong?
Source: (StackOverflow)
I am using the jQuery validation plugin. Great stuff! I want to migrate my existing ASP.NET solution to use jQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator. I want to be able to do something like this:
$("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s]{1,40}$" })
How do I add a custom rule to achieve this?
Source: (StackOverflow)
I use Rails 3.0.0.beta4
I want to add a validation on uniqueness on two attributes, that means that my model is valid if the couple of 'recorded_at'
and 'zipcode'
is unique.
On one attribute here is the syntax
validates :zipcode, :uniqueness => true
thanks
Source: (StackOverflow)
I use this
@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"
regexp to validate the email
([\w\.\-]+)
- this is for the first-level domain (many letters and numbers, also point and hyphen)
([\w\-]+)
- this is for second-level domain
((\.(\w){2,3})+)
- and this is for other level domains(from 3 to infinity) which includes a point and 2 or 3 literals
what's wrong with this regex?
EDIT:it doesn't match the "something@someth.ing" email
Source: (StackOverflow)
Everytime a user posts something containing < or >
in a page in my webapp, I get this exception thrown.
I don't want to go into the discussion about the smartness of throwing an exception or crashing an entire webapp because somebody entered a character in a text box, but I am looking for an elegant way to handle this.
Trapping the exception and showing An error has occured please go back and re-type your entire form again, but this time please do not use <
doesn't seem professional enough to me
Disabling post validation ( validateRequest="false"
) will definitely avoid this error, but it will leave the page vulnerable to a number of attacks.
Ideally: when a post back occurs containing HTML restricted characters, that posted value in the Form collection will be automatically HTML encoded.
So the .Text
property of my text-box will be something & lt; html & gt;
Any way I can do this from a handler?
Source: (StackOverflow)