validation

How do I return errors from my asp.net mvc controller when doing a jquery ajax post?

Hi! I'm creating a website in ASP.NET MVC and have stumbled across something I really can't figure out. I've got a user profile page that allows a user to change his password. On the serverside, I want to validate that the user has entered a correct "current" password before allowing the change. What's the best way to return to my Vi...

Validating nested string in java

Hi what is the best way to validate a nested string in java? sample valid string is [aaaa{bbb}] while [{ss]} is not. Thanks! ...

ModelState without a field?

I've got a controller action like this: [ActionName("Create"), AcceptVerbs(HttpVerbs.Post)] public ActionResult Save([Bind(Exclude="Id")]Project project) { try { _projectRepository.Save(project); return RedirectToAction("Details", new { id = project.Id }); } catch (PropertyValueException ex) { ...

jquery validation plugin selected control

hello I can't control radio buttons with jquery validation plugin. when i delete the default values, it works. But I can't post my default values. best regards ...

Using ASP.NET Compare Validator to make sure field is unique

I would like to use a Validator to guarantee that a given textbox's submitted content is unique. I want to make sure that the name put into the box is not the same as any other text box. The catch is I don't know at compile time how many other text boxes it will be compared to. It could be anywhere from 0 - n other name text boxes. Tha...

ASP.Net validation summary causes page to jump to top

I have a simple form with a few required field validators and a validation summary control. When I submit the form, the client validation will cause the form to jump to the top of the page. If i remove the validation summary, the page does not move. Heres a quick example (pardon the line breaks): <br /><br /><br /><br /><br /><br /><...

Validating parameters to a bash script

I'm a total newbie to doing any bash scripting, but I came up with a basic one to help automate the process of removing a number of folders as they become unneeded. #!/bin/bash rm -rf ~/myfolder1/$1/anotherfolder rm -rf ~/myfolder2/$1/yetanotherfolder rm -rf ~/myfolder3/$1/thisisafolder This is evoked like so: ./myscript.sh <{id-numb...

Should my repository enforce validity of data, if so, where and how?

I have a repository data access pattern like so: IRepository<T> { .. query members .. void Add(T item); void Remove(T item); void SaveChanges(); } Imagine the scenario where I have a repository of users, users have a user name which is unique, if I create a new user with a username that exists (imagine I have a dumb ui layer t...

Sample text that will invalidate ASP.NET text input?

I need to do some checking on a validation control but I am not sure what type of text ASP.NET will think is a security issue. Can someone give me some things to try? I tried various HTML tags and it seemed to accept them fine. This is a multiline rich textbox used for saving a field of text to the database. The code for saving is inside...

Valid email address regular expression?

I have done some testing but I wanted to ask if anyone sees a problem with this ruby regular expression for email validation: /\A([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})\Z/i Look good? Thanks, Tony ...

WPF - How to apply style to AdornedElementPlaceholder's AdornedElement?

I'm trying to apply a style to an adorned element, but I don't know the correct syntax. Here is what I've tried: <!-- ValidationRule Based Validitaion Control Template --> <ControlTemplate x:Key="validationTemplate"...

Ruby on Rails: errors.add_to_base vs. errors.add

I have read that errors.add_to_base should be used for errors associated with the object and not a specific attribute. I am having trouble conceptualizing what this means. Could someone provide an example of when I would want to use each? For example, I have a Band model and each Band has a Genre. When I validate the presence of a ge...

How do you validate a composite format string in C# against its target argument types?

Given a composite format string provided by the user (for use with String.Format) and a set of types representing the arguments that would be used to format the composite format string, how can you check that the user-provided value is valid? It should be pretty easy to create a regular expression to check that the general syntax of the...

Creating a timed validation with PHP and MySQL

How would I go about creating a system in which a user must click a link to validate something. Let us say that on my website, each user has their own folders that are not shared. I want their to be an option for each user on their account page in which they can create a trust with another user to access each others folders. Perhaps by ...

Asp.Net Validaterequest False

I'm creating an Asp.Net program UI where users can browse and change information in a database. For this reason, they need to be able to use all forms of chars, but I still need to keep the program HTML and SQL itself secure. For that reason, I'm using a self-built method that replaces dangerous chars such as '<' etc with their html-code...

Selective Validation

I have a form that have many text fields and all are being validated, I also added the NiceEdit plugin to be able to format text in my text areas, but it is raising errors like: A potentially dangerous Request.Form value was detected from the client Now I can simply go to the top of the page and in the page directive add ValidateReques...

Checking if the string is empty

I have a function isNotEmpty which returns true if the string is not empty and false if the string is empty. I've found out that it is not working if I pass an empty string through it. function isNotEmpty($input) { $strTemp = $input; $strTemp = trim($strTemp); if(strTemp != '') //Also tried this "if(strlen($strTemp) > 0)"...

Combining form validation and closing the popup window?

How can I make sure that the window doesn't close before the form is valid and properly submited? Because now it closes the popup and nobady knows if the form was valid. Because even iff there are errors the form is immediately closed. $(document).ready(function(){ $(".requestPassword").hide(); $(".popupwindow").popupwindow(pro...

Checking a data conforms to a list of rules

Hi, I'm interested in understanding if there is a common technique/pattern for checking data in a database conforms to a set of rules. I'm interested, perhaps, in running a service/job each night that churns through the data and raises exceptions to rules. I would quite like the system to be dynamic, i.e. it's quite easy to define new r...

Delphi CMExit message not sent when modal dialog is closed?

In one part of the application I'm working on, there is a form control that does validation on reception of the CMExit message, which is exactly how the Delphi documentation says to do it (this code sample is from the Delphi Help files): procedure TDBCalendar.CMExit(var Message: TWMNoParams); begin try FDataLink.UpdateRecord; ...