validation

Rails Modal Form Validation

I am using Lightbox Gone Wild to display a modal dialog with a form inside. I am using a vanilla New view. This works like a champ up until a user doesn't input valid form data. Invalid data causes the controller to direct the user to the New view directly with the error message. Obviously, I would prefer the error be returned to the mod...

Validation in the business logic - ASP.NET Web Forms

In reading up on ASP.NET MVC I came across some wonderful examples of validation where the business rules were associated with the model and the UI merely displayed the set of errors and flagged the form elements associated with invalid input. I think it makes fantastic sense to keep this logic in a single place rather than have every f...

"This property setter is obsolete, because its value is derived from ModelMetadata.Model now."

http://www.asp.net/learn/mvc/tutorial-39-cs.aspx We are using the above guide to implement some validation in our ASP.NET MVC app. We receive the following error This property setter is obsolete, because its value is derived from ModelMetadata.Model now. which does not have a line number, it simply explodes when pressing the submit but...

Using xVal and a ViewModel

I saw a similar post that was trying to do this same thing with the Dinner example, but he fixed his issue mine seems to be a little deeper. Basically I cxan get the validation to work just fine but it only works in Firefox. In IE7 when the page loads, I immediately get an alert box with the following message: "Error: Element title is no...

Can ADO.NET create its own basic validation by reflecting the database structure?

I am now to the stage of adding validation to a simple app for editing a few SQL tables via data-bound controls. I can see that the BindingSource knows the limits of the table's structure: if I enter, for example, letters in a field that should contain only decimals, up pops a DataError exception with the message that you can only enter ...

Errors deleted in validation with valid? in Rails

I'm trying to create a form validation. I added @user.errors.add_to_base "TEST" to my controller, and if I call @user.valid?, it returns false (yes, this is correct). But the error "TEST" isn't displayed (errors from the model, like from validates_presence_of, are). Why does it 'delete' my error? How can I avoid it? ...

Struts 2 - Problemas with validation/convertion of BigDecimal

Hi. I'm having some problems trying to convert/validate a java.math.BigDecimal[][] in a Struts 2 action class. I need to display the values localized (pt_BR) so I wrote a BigDecimal converter. Then I wrote a simples MyAction-convertion.properties file: quadroInvestimentos=my.package.converter.BigDecimalConverter My action class has a ...

Validate email address form submit

Hi there, I've got a simple form that enables users to enter a promotional code and email address to be signed up to an email as follows. But at present it doesn't validate the email correctly. There is an include file doreferral.asp that; Checks to see if the code they entered exists in a table of promotional codes and also Checks to ...

Where should form validation occur in a MVC project?

I'm using Kohana, but I think this question is more general. I have been doing form validation in the controller, and it has worked well so far. But lately, I've ran into a problem. I have a comments model, and I send comments from a few different controllers to it. Instead of having a validator in every controller, I placed it in the ...

Combine DataAnnotations Validation with complex business rules

I understand annotating class properties with the basic required and minimum length and getting all the benefits of the asp.net mvc server side and client side validation. However does anyone have a link that shows how you combine this 'base' validation with more complex business rules. How would I run business rule functions, such as ...

Rails validation over redirect

I'm trying out the beast forum written in rails and will use this as an example of a problem I keep facing. The forum has a topics/show action and view with a form at the bottom to create a new post within the topic. Submitting the form goes to posts/create and if the validation passes redirects back to topics/show and works fine, howe...

What's the best-practice way to process a contact form?

It seems I'm coding contact forms for someone or another every week. I've developed a validate/mail client/mail thankyou/save to DB/thankspage process that's fairly robust but I was wondering what lessons others have for performing this most common of website tasks? ...

(X)HTML+CSS Validation warnings

I try to pass my css valiation yet I still have a few warnings like the following: In (x)HTML+CSS, floated elements need to have a width declared. Only elements with an intrinsic width (html, img, input, textarea, select, or object) are not affected In fact, I don't understand very well what it relly means. Anyone can explain? ...

c# XML DTD validation. ENTITY is an unexpected token

Hi all, Im trying to validate an XML file using a .DTD but it gives me the following error. 'ENTITY' is an unexpected token. The expected token is 'DOCTYPE'. Line 538, position 3. public static void Validate(string xmlFilename, string schemaFilename) { XmlTextReader r = new XmlTextReader(xmlFilename); X...

Doing serverside validation then posting to remote script

Hi folks, I had thought I would use curl for this but it looks like I was mistaken. What I need to do is catch a post and do some database lookups for validation purposes and then post the validated data to a remote URL. I have done this by populating an html form and submitting it using javascript but this has obvious flaws. I want ...

stop record from being saved if all empty strings in rails

I currently have a nested forms model. The nested forms for the paperclip attachments work fi and don't populate the DB with blanks, but another one I have for quotes always saves one blank quote along with my main model when I create a new one. How can I just have it silently fail and bypass writing this to the db? It's an optional fiel...

What is the recommended method to Validate an ASP.net Control with an existing method?

I am wondering what the prefered method of validating user input in asp.net using an existing method call is. I have implemented this a couple of ways now and while they all work I get the sense that there might be a better or "optimal" method? I have an asp.net textbox <asp:TextBox ID="myTextBox" runat="server" /> I also have a cou...

How to validate an XML document using a RELAX NG schema and JAXP?

I would like to validate XML documents using RELAX NG schemata, and I would like to use the JAXP validation API. From Googling around, it appeared that I could use Jing and the ISO RELAX JARV to JAXP Bridge. Unfortunately, after adding both to my classpath, I can't get it to work. SchemaFactory is just throwing an IllegalArgumentExcepti...

jQuery input validation for double/float

Hi What's the best method to mask an input field to only allow float/double, without any jquery plugin. Acutally i'm doing it like this: $("#defaultvalue").bind("keypress", function(e) { if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; } ...

c# .net validation both textboxes cannot be blank

Hello all, I am using C#.net. I have two textboxes (textbox1 / textbox2). If both are empty it needs to display a error message. I tried a CustomValidator control and had it validating on textbox2. Within my code behind I checked whether both were empty if so it returned false (args = false). However when I built the application, it d...