validation

input[type=file] validation

Hi guys, how can I check if the input file is not empty? I tried: $('#image-file').click(function() { if ( ! $('#image-file').val() ) { alert('Chose a file!'); return false; } }); but it didn't work. ...

PHP function to turn arbitrary "description" into valid xml data for podcast feed

I am reading the documentation for creating a podcast feed suitable for iTunes, and the Common Mistakes section says: Using HTML Named Character Entities. <! — illegal xml — > <copyright>&copy; 2005 John Doe</copyright> <! — valid xml — > <copyright>&#xA9; 2005 John Doe</copyright> Unlike HTML, XML supports only five "named c...

Problem in alphanumeric regular expression in javascript

i want to validate user input for alphanumeric characters and for that im using var regex = /^[a-zA-Z_0-9]$/; var asdfsfd = $('#vcr_LinkName').val(); if (regex.test(asdfsfd)) { alert("true"); } else { alert("false"); ...

formular validation in mvc php

i have written validation class. now, is it ok to extend a form class from the validation class? or even extending the validation class from the request class? i'm just not sure how to implement the registration process for a new user in a mvc. totally confuse. Edit: i have found this zend tut here: // application/controllers/Guestboo...

Сustom server side validation in ASP.NET + VB.NET

Hi, This has not happened to me before, but for some reason server side validation events are not being triggered: I'm using Code below <asp:CustomValidator runat="server" id="RefId" OnServerValidate="Ref_Id" ControlToValidate="txtRefId" ErrorMessage="Referral ID is Required." ></asp:CustomValidator> When I fix the debugger on below ...

Asp.net MVC validation for non-strings

I originally built my site in MVC 1.0 using the NerdDinner tutorial as a basic outline. Many of the early design decisions were made simply b/c "that's how NerdDinner did it" Since then, it has really grown and was converted to 2.0. My validation still works the way NerdDinner did it and is very minimal, so although I've read about ot...

Django Form Validation in v1.2.1

I'm using django-bookmarks for one of my projects and recently updated to Django 1.2.1. I noticed that the form submit does not validate since the update. Please note that I did confirm this is working with Django v1.1.1, so the new version and form field validation is different. This is the model that forms.py is building off of: cl...

Manually Set ModelState.isValid from Controller

Is there a way for me to manually set the ModelState.isValid = False from the controller? I have some code like this Dim _region As Domain.Region = RegionService.GetRegionByNameAndParentID(user.UserRegion, user.ParentRegionID) If ModelState.IsValid AndAlso Not _region Is Nothing Then ''# ... Else Retur...

Validating a self-referential association doesn't link back to the original instance in rails

I have a many-to-many model, following the example in this great railscast My model links authors to each other. I'd like to validate that an author cannot friend himself. I know I can handle this at the UI level, but I'd love to have a validation in place to prevent a bug in the UI from allowing it. I've tried validates_exclusion_of, b...

Silverlight 4, RIA Services Multi-step Server Side Validation

Newbie question, I have a simple Silverlight 4 client. I'm creating some methods on the server side to handle new user creation / validation. Before I create the user, I'd like to validate a number of things. Does the user name already exist? Is the email address valid? Does the password pass strictness checking? Etc, etc. I'm not ...

Jquery Validation Plugin - Select Box Problems.

I have 9 select boxes on my page containing lots of subcategories for businesses. I require the user to select an option from only 1 of the 9 selects. To make the user experience better I hide all of the select boxes with CSS and generate a dynamic select box of categories. When a category is selected from the generated dropdown, the s...

Good reasons not to use client-side validation anymore (in additon to server-side)?

Looking at five or six login sections for various major 'web 2.0' sites, many of them seem to do all the validation server-side. Can anyone provide any reasons for why none of these use client side validation aswell (i.e. javascript)? A prime example would be checking for empty text boxes when the user clicks 'login' and popping up an...

Drupal: full cycle form with parameters and response page.

I am trying to make a full cycle form with parameters and response page. Form is working OK, but response page is coming up black. Anyone have a suggestion or model example. function module99_menu(){ $items = array(); // inital form $items['module-99'] = array( 'title' => t('Export'), // Page title ...

WebService asp:ServiceReference(?) generates inavlid html "/// <param name"

Hi, I'm developing an web app in asp.net/jQuery/json Using: WebService: [WebService(Namespace = "http://test/services.internal")] [ToolboxItem(false)] [ScriptService] public class AsdfWebService: WebService { [WebMethod] [ScriptMethod] public string GetAsdf(string bla) { in aspx: <asp:ScriptManager ID="ScriptManager...

Rails model validation - validates_inclusion_of...

I have a string column in a table that can have a range of predefined values. It can also include a nil value. For ex: Dog, Cat, Bird, nil. I want to write a validates_inclusion_of that checks to make sure all the values being entered fall within that predefined range. If, for ex, "Nasal Spray" is entered, it will throw an error. Wha...

chrome fails on jquery form validation

Can someone explain to me why the form validation fails in chrome? http://tinyurl.com/3yphwpl Pressing the submit should colour empty fields red. I have no idea why chrome fails - would be glad to find a solution... $('form .meet').focus(function() { $('form .required').each(function() { if($(this).val() == '') { ...

find_or_create_by_name with has_many :through

Artists have many Events. Events have many Artists. The join between these two models is called Performances. I'm trying to associate Artists with Events on the Event add/edit page. I would like to be able to add an Artist only if it doesn't exist, and create the join (performance) regardless. An Artist should be associated with an Even...

How can i validate this attribute(annonation) ?

I am new about attributes. I just try it on my console application. So how can i validate my person instance below example ? class Person { [StringLength(8,ErrorMessage="Please less then 8 character")] public string Name { get; set; } } ...

Implementing a class-level validation attribute that writes to a property inside the class

I'm building an ASP.NET MVC site where I want to decorate my ViewModels with validation attributes. One of the things I want to validate is that the address that a user submits through a form is geocodable. For that, I have already created a custom ValidationAttribute and have applied to my StreetAddress property. This is all good, exce...

Check for valid link (URL)

I was reading though this other question which has some really good regex's for the job but as far as I can see non of them work with BASH commands as BASH commands don't support such complex rexeg's. if echo "http://www.google.com/test/link.php" | grep -q '(https?|ftp|file)://[-A-Z0-9\+&@#/%?=~_|!:,.;]*[-A-Z0-9\+&@#/%=~_|]'; then ...