Is it a best practice to validate JSON?
With both a JSON schema proposal and a JavaScript implementation of a JSON Schema validator, this practice would seem relatively frictionless to implement. So, is it a no-brainer that should be part of any robust application? Or do you employ other preferred strategies to handle bad JSON?
...
I recently have been moving a bunch of MP3s from various locations into a repository. I had been constructing the new file names using the ID3 tags (thanks, TagLib-Sharp!), and I noticed that I was getting a System.NotSupportedException: "The given path's format is not supported." This was generated by either File.Copy() or Directory.Cre...
I want my errors to float above, left-justified, the input field that doesn't validate. How can I do this?
If I can't, how can I turn the errors off? I still want the fields to validate (and highlight on error), but not for the actual error messages to display. I couldn't seem to find anything in the jQuery docs that would let me tur...
On the PHP website, the only real checking they suggest is using is_uploaded_file() or move_uploaded_file(), here. Of course you usually don't want user's uploading any type of time, for a variety of reasons.
Because of this, I have often used some "strict" mime type checking. Of course this is very flawed because often mime types are w...
I am using the date picker provided by jQuery UI to select a date range that ends up in a single text input with something like 11/11/2008 - 12/05/2008. What would you recommend as far a validation (jQuery/JavaScript) on the client side as well as code for validation on the server side (ASP.NET/C#) to make sure the user enters valid dat...
i need a C# library about strict HTML validation and filtering
...
I need to be able to see if a form input in PHP is numeric. If it is not numeric, the website should redirect. I have tried is_numeric() but it does not seem to work.
Code examples will be nice.
I am developing a shopping cart that accepts an interger value for the quantity. I am trying this:
if(!is_numeric($quantity)){
...
I have a set of radio buttons where a selection is required. In addition, there is an optional text box that shows up next to one of the selections.
What would be the best way to make it clear what is required and what is optional?
<strong>User Availability:</strong><br>
<input value="Available" type="radio"> Available<br />
<input va...
What's the best way to validate that an IP entered by the user is valid? It comes in as a string.
...
I am trying to validate xml file against schema using XML::Validator::Schema.
But it gives me this error:
Found unexpected <Submission> inside <<<<ROOT>>>>. This is not a valid child element. [Ln: 2, Col:119]
Note: <Submission> is the very first element I have after <xml version="1.0" encoding="UTF-8"?>
I can't figure out what it ...
I have a situation where I am using wpf data binding and validation using the ExceptionValidationRule.
Another part of the solution invovles collapsing some panels and showing others.
If a validation exception is set - i.e. the UI is showing a red border around the UI element with the validation problem, and the containing panel is col...
I need to validate an XML agaist a schema.
I tried XML::SAX::ParserFactory; XML::Validator::Schema and related modules but looks like they are limited.
Limited in the sense that it didn't recognize schema elements such as xsd:unique, xsd:group, xsd:keyref, xsd:union and xsd:key.
Are these xsd:unique, etc. new additions?
Appreciate...
What can I do to comprehensively validate an Australian Phone Number? I need this for an application I'm writing. You can assume it is dialed from within Australia. I want to use a white-list approach.
Here are my rules so far (after removing any whitespace):-
Starts with 13 and is 6 digits long
Starts with 1300 and is 10 digits lon...
I'm trying to make a BEA Portal website XHTML compliant, because this has been written in the contract with the client, and I'm stuck on this problem: BEA renders <meta> and <link> tags without the closing slash, i.e. <link/> and <meta/> as it is required by XHTML.
When I look at the documentation from BEA it seems that it should be pos...
This is a Rails/ActiveRecord question.
I have a model which basically has to represent events or performances. Each event has many attributions: an attribution is basically something like "In this event, Person X had Role Y".
I concluded that the best way to allow a user to edit this data is by providing a free text field which expects...
I have a requirement to disallow backslash characters in a given string field defined by an xsd document. However, being as green as I am, I am not confident with my xsd and/or regex knowledge. Here is what I have so far:
<xs:simpleType name="BackslashRestrictedField">
<xs:restriction base="xs:string">
<xs:minLength value="0" />...
I am making a C# app for a class project. I want to ensure a string has one of three values. Normally, in a web app, I would do validation with javascript on the client side. However, this is currently a console app. I know that I should do the validation early, but what are some good rules of thumb for validation?
...
In Django 1.0, what is the best way to catch and show an error if user enters only whitespace (" ") in a form field?
class Item(models.Model):
description = models.CharField(max_length=100)
class ItemForm(ModelForm):
class Meta:
model = Item
if user enters only whitespace (" ") in description CharField, what change ne...
We want to allow "normal" href links to other webpages, but we don't want to allow anyone to sneak in client-side scripting.
Is searching for "javascript:" within the HREF and onclick/onmouseover/etc. events good enough? Or are there other things to check?
...
Just looking at:
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?
...