form-validation

jquery Return Random Value from array.

So this should be a relativly easy thing for most people but I'm having trouble with it. I'm using the jquery validate plugin and would like to return a random vaule on success. Right now I'm trying to use. var success_message = new Array (); success_message[0] = "Good!"; success_message[1] = "Ok!"; success_message[2] = ...

textbox validation

how to get all text box in loop for validation to check all like if (textbox.text == "",textbox2.text == "",textbox3.text == "") { textbox.Focus(); } ...

I need to validate data from multiple tables... how should i do it?

How should I validate data going into multiple tables that all depend on each other? I have a debate site, where users can start a debate and with their debate submit "survey options" so people can choose an option when they reply to the debate. The validation process goes like this, the debate model validates that the columns specifi...

how to validate a text field using selection of a radion button in struts2

I need to validate two text fields as email and mobile number. I need to validate these based on the user selection of radio buttons. If the user selected the email option in radio button, then email text filed should be validated if he selected mobile number then need to validate mobile number text field. Since I use struts2 I have no ...

Using jQuery to check for regular expressions

Hi all, I know there's the jQuery validation plugin. But I don't need something that extensive. All I want to do is have jQuery check a name text box: <input type="text" name="name" id="name" /> To make sure that it has at least 2 characters AND I want jQuery to check a phone text box (identical to the name text box, name="phone" ...

validate username, password and email with php

Hi. I am working on validating username, pass and email with php. I need to be sure I get it right so nobody can bypass the login page. This is the values: $email=$_POST['email']; $username=$_POST['uname']; $passwd=$_POST['pass']; $passwd2=$_POST['passcopy']; So far I have email validation: if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-...

Why should you validate forms using javascript?

What is the point in validating your HTML forms using Javascript, if you are always going to need to validate the forms using PHP anyway? I realize that you get a speed boost from this, and its more convenient to the user, but beyond that, is the time spent on it worth it? If anyone has any good evidence on this I would love to hear it. ...

What validation must a form include? Best practices

I am trying to put together a checklist things I need to keep in mind when creating forms. I know I need to filter input content. I already am filtering for errant html and scripts, escaping mysql, and limiting to data types(phone numbers are 10+ digits with training extension digits, email has to be email, strings cannot contain html ...

Using CodeIgniter built-in form validator class without an actual form submission

Is it possible to validate a set of data (an array) with the form validation class in CodeIdniter? i.e. when there his no form submitted. If it's not possible, what other way could I validate this data using the set of validation rules written in form_validation config file? Thanks in advance! ...

Javascript form-validation framework: Request for Review

I wasn't sure if I could ask this kind of question, but after seeing this on Meta Stackoverflow, it looks like this kind of question is ok. Well, onto my question: A few months ago I wrote a validation framework in Javascript. I know that there already exist validation frameworks like jQuery Validation, but I wanted to take a different ...

Validation Attribute - checking a dynamic number of fields on a form ASP.NET MVC 2

Hi there! I have a number of forms with checkboxes that need validating. For example I might have a form with 3 checkboxes and one of those 3 needs ticking and another form with 50 boxes that might need at least one item checking. Does anyone have a ValidationAttribute that would work under these circumstances. Many thanks for any poi...

Validating a form for email exploits is not working

Hello, I have a contact form in my website. I made a class to handle the whole process. But there is something not working in it. I have 2 functions to check for exploitation and they are not working. I don't know what's wrong with them, so here they are : private function _validateExploit($val) { $exploitPattrens = array('conten...

Why client-side validation is not enough ?

I saw here that: As you probably already know, relying on client-side validation alone is a very bad idea. Always perform appropriate server-side validation as well. Could you explain why server-side validation is a must ? ...

jQuery Validation Plugin and Same/Duplicate Name Attributes.

Hi, first post here. I am using the jQuery validation plugin, to validate some custom forms, and submitting the forms to a CRM tool. The CRM tool has a wide array of Data variables, that we can post too, but on occasion there are fields which don't match and we need to post these all into the notes field in the CRM tool. Now the proble...

ASP image button onclick event does not fire in IE, works in Firefox and chrome

Onclick event of imagebutton (inside usercontrol) does not get fired in IE, it works in Firefox and chrome. The usercontrol contains some required field validations as well as a popup. Code below: <asp:ImageButton ID="btnSend" ImageUrl="~/images/send.gif" ValidationGroup="SiteFeedback" CausesValidation="true" runat="server" Ta...

A logical method of displaying post submit error messages using php

//deal with individual form section posts //-->Faction Name if(isset($_POST['factionname'])){ $unsani_faction_name = $_POST['faction']; $new_faction_name = str_replace(",", "", $unsani_faction_name); $faction_name = mysql_real_escape_string($new_faction_name); $faction_name = preg_replace('/\s\s+/', ' ', $faction_name);//...

jQuery validator plug-in: validate optional field

Problem I want to validate a field using a custom validator I've created that's essentially a regex for a phone number only IF the field has a value, otherwise it doesn't need to be validated because it's optional. Custom validator: $.validator.addMethod('phone', function (value) { return /^[01]?[- .]?\(?[2-9]\d{2}\)?[- .]?\d...

Codeigniter - form validation check for default value in <input>

Hi, I have default values set on form inputs and the form submits because the onlt rule I need to apply in this case is trim|required. How can I check if the submitted value is equal to the default and display an error? Thanks ...

Problem with centralized form validation framework for an ASP.NET(C#) 3.5 web app using ASP.NET validation controls and AJAX?

Hi, I need to implement a centralized form validation framework for my ASP.NET(C#) 3.5 website. And for this I have tried the following solutions- http://blogs.msdn.com/b/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx http://validationframework.codeplex.com/ I have added the .dll file in my project's BIN folder and for ...

How to validate for save but not for delete?

Here is a snippet of my form <form action="" method="post" onsubmit="return verify()"> <input type="submit" name="submit" value="Delete" /> <input type="submit" name="submit" value="Save" /> </form> As you can see I am verifying with a function called verify(). I only want to verify if they click "save", I do not want ...