form-validation

Validate Property With Attribute (Alternative to Enterprise Lib Validation Block)

Are there any alternative to Enterprise Library Validation Block? I want to be able to add validation attributes to my properties. Thanks ...

validating 1 input of multiple inputs using jquery

I've got multiple input fields where they have the same class names. I need to check to make sure at least 1 of them isn't empty. So I've got, $('form[name=expForm]').submit(function(){ var msg = ""; var found = false; $('.date-mask').each(function(){ if($(this).val()){ found = true; } }); if (found != true) { msg += "P...

Not including field names in validation error messages

If I have the following validation: validates_inclusion_of :dob, :in => Date.new(1900)..Time.now.years_ago(18).to_date, :message => "You must be 18 or older to register" The actual message on the site that shows up is: "Dob You must be 18 or older to register" Is there any way not to include the column name at the beginning of the m...

How do I pass form elements to a javascript validation function?

I have a form that lists users, and for each user there is a drop down menu (2 choices: waiting, finished) and a comments textbox. The drop down menus are each labeled "status-userid" and the comments textbox is labeled "comments-userid" ... so for user 92, the fields in his row are labeled status-92 and comments-92. I need to validate...

JQuery form gets submitted even validation is returning false

My below mentioned code still submits form on special character in name field. Validation works but If I submit repeatedly it breaks and submits the form with special chars in name. What could be the reason for this? $("#fee").submit(function(){ trimmedValue = $.trim($("#name").val()); $("#name").val(trimmedValue); typevalue =...

Setting type "password" inputs with value from previous submit after validation failure

I'm creating a walkup create account page for our website. I've always cleared out the default value="" for a type="password" input out of paranoia, after a user has submitted a form, even if the two passwords match and are valid. I started to think on this after our designer asked me if there was any real point to doing that. I can cert...

.NET C# - Call a javascript method after the page has validated?

I have a simple javascript (JQuery based) method that does some css magic to show/hide some divs when a user submits a .net web form function doShowHide() { $('.Button').hide(); $('.ButtonHdn').show(); } I'm using the built in .net control validation, so I need the WebForm_DoPostBackWithOptions() method to run in addition to the j...

Codeigniter form validation callback function not working

Hi I've written a simple callback function which isn't working. My other callbacks (which are in the same library file) work fine so I guess the problem has to do with my code. The parameter passed in the callback function takes the form of a chunk of PHP which is eval()'ed to form part of an 'if()' statement in the function itself. H...

Validate dates before executing sql in asp.net

I have a data grid bound to a data source in the typical way (simplified for brevity): <asp:SqlDataSource ID="ds" runat="server" ConnectionString="xxx" ProviderName="yyy" SelectCommand="SELECT "a from A where date > ?"> <SelectParameters> <asp:ControlParameter ControlID="txtDateFrom" Name="fromDate" PropertyName="Value"...

jQuery Validation Submitting without Validation in Firefox

Hi Guys, I've put together a pretty simple competition script - it's commented out below and you can find the demo at http://www.jakeisonline.com/stackoverflow/jqueryvalidation/page/ I am using a jquery plugin to achieve the validation: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ The problem is only in Firefox (3.5....

How to do in-line form validation of multi-field business rules (repository) in MVC?

There is a study here my co-worker took to my notice. Basically, that in-line form validation is a good thing. But how would you do in-line multi-field form validation in MVC assuming you already have a "yield return" setup to return a list of form violations? Is the in-line validation only for primitive values like "a zip code should...

Email validation in C# (within the page_load)

Hi all, I'm quite new to this: I have created a simple form which contains a textbox and button and basically when the email address entered is correct, some results are shown below (this is using a gridview control). What I am wanting to do is have some sort of email validation for the form - but have the validation placed within the ...

ASP.NET MVC Data Annotations Validation ErrorMessageResourceType

When using Data Annotations Valition, everything works fine until I try to use resources. Here's the error I get: The name 'ErrorMessageResourceType' does not exist in the current context. And the code I used: using System.ComponentModel; using System.ComponentModel.DataAnnotations; using Microsoft.Web.Mvc; namespace Project.Models ...

DIY Form handling, PRG, Validation

I would like to implement form handling for web apps. I'd like to implement PRG (post-redirect-get), as I believe it is the way to go in form handling (plays very nicely with reload and back button). However, I'm seeing that it complicates validation. Basically, when you post, you have the form state (as post parameters). However, if yo...

ASP.NET web application - Serverside validation of form field’s data

Hi, We are building an ASP.NET application with C#.net as language. Here we are validating the form field’s data at client side using ASP.NET validation controls. Now we are planning to validate the form field’s data at the server side too, to avoid script injections by hackers. Would you please guide me on this, if you have an idea? ...

how can i validate a url in javascript using regular expression

i want to validate a textbox who have some url value like blogs address or site adress how can i validate this textbox in js ...

Adding jQuery conditional validation to dynamically-generated HTML

I have the following HTML scenario: <div> <input id="txt0" type="text" /><input type="checkbox" id="chk0" /></div> <div> <input id="txt1" type="text" /><input type="checkbox" id="chk1" /></div> <!-- etc --> <div> <input id="txtN" type="text" /><input type="checkbox" id="chkN" /></div> If checkbox N is checked, then textbox...

How do I display an error message in asp.net?

I have a bunch of text boxes and a save button to update something. When I click "Save" I have code that determines whether they are correctly filled in, in the code behind file. If they are not correctly filled in, I want to display an error message in the form of an alert. What is the best way to do this? Pressing the button obviousl...

jquery/javascript alert if all fields are not completed

Hi all, I have a form which I'd like to alert people if ALL of the fields aren't completed. I am currently using a jquery validation script for the required fields, but I need it to also let people know that not all of the fields are filled out before saving (they're not required fields, but just to let them know that the form isn't fini...

Do not require non-NULL field (allow empty strings) in FormAlchemy

I'm fairly novice to FormAlchemy and it seems that I don't get something. I have a SQLAlchemy model defined like this: ... class Device(meta.Base): __tablename__ = 'devices' id = sa.Column('id_device', sa.types.Integer, primary_key=True) serial_number = sa.Column('sn', sa.types.Unicode(length=20), nullable=False) mac = ...