I have a multiple select, and I need to force the user to choose maximum two options, nothing more.
I'm trying this:
jQuery.validator.addMethod("morethantwo",
function(value, element) {
var foo = [];
$(element+' :selected').each(function(i, selected){
foo[i] = $(selected).text();
alert(foo[...
I have a simple model FilesModel for updating a string Description and the boolean value of a checkbox Archived for a few (already uploaded) files, and FilesModel has a validator FilesModelValidator that gets run when this data is posted. This validator does nothing more than check that each file has a description. I know that it runs an...
I have a view to display a list of items.
The user can edit, delete or create new items, but according to their authorizations they may or may not be allowed to do some of this actions.
I have the requirement to display only the actions which the current user is allowed to do, but I don't want to clutter the views with authorization if...
Is there anyway to have the validates_attachment_size except a dynamic file size limit? Here's an example:
class Document < ActiveRecord::Base
belongs_to :folder
has_attached_file :document
validates_attachment_size :document, :less_than => get_current_file_size_limit
private
def get_current_file_size_limit
10.mega...
Hello fellow stackoverflow members.
I have been following this guide to enable users to have their own avatar.
But i have bumped in to a litle problem.
When the user is cropping the image the model tries to validate all my validations.
My user model looks like this:
class User < ActiveRecord::Base
has_attached_file :avatar, :styles...
Hello,
I'm using a rich text editor in my asp.net mvc form (nicedit with a textarea) and when I submit the form on post, because it is not html encoded I get the following message:
"A potentially dangerous Request.Form value was detected from the client" .
How can I html encode the textarea on post ? I don't want to cancel the validation...
I am trying to validate a form in MVC.
I add custom errors to model state and get it as invalid when form is submitted. When the view is displayed it doesn’t show validation messages nor validation summary. Can anyone please let me know what am I doing wrong or point me in the right direction if there is any other way of validating?
...
Hello again,
is anyone find validation for zipcode for all countries around the world. i found mostly US,Canada and UK validation scripts in Javascript.
any gimme any suggestion how to validate the international zipcodes either in php or js.
...
I have a jQuery Dialog form and on submit I'm trying to validate the fields. I'm using jQuery Validation plugin to validate. In this I'm facing an issue, the validate function is not being called.
I'm posting some snippet of my code:
$("#register-dialog-form").dialog({
autoOpen: false,
height: 350,
width: 450,
modal: tr...
I am using jquery validation plugin. I have an 'add file field' button which will add new file fields dynamically on click. I want to validate these fields on submit. How can I do this ? Please help..
...
I'm trying to write validation rules for my data objects in a WPF application. I'm writing them in the configuration file, and so far they are working fine.
I'm stumped on how to localize the messages using messageTemplateResourceName and messageTemplateResourceType. What I know is that the strings can be writen in a resource file, giv...
I'm populating a DropDownList using JS on the client and validating with a RequiredFieldValidator.
This works fine on the client but the Page.IsValid consistently comes back false on the server.
Is this because the selected value wasn't in the DropDownList when it was first served to the page?
What's the easiest way around this? (I ne...
I have a page where jquery + other js's is being loaded:
<script src="/eiv/javascripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/eiv/javascripts/jquery.jeditable.js" type="text/javascript"></script>
<script src="/eiv/javascripts/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
<script src="/eiv/j...
Hi,
I want to assert that my registrations are valid, i.e no dependency is missing and there are no circular dependencies.
I'd like to do that in my application (and not in a unit-test) so I'd be able to fail-fast if the configuration is invalid.
I also want to accomplish that without resolving (and instantiating) all the components - on...
Hi,
I'm using Symfony 1.2 with Doctrine. I have an object with the i18n behaviour. If I have the following validators, it fails when saving the form with error "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null" (it tries to save the object_translation before saving the object)
$this->validatorSchema['pho...
Hi There,
I have a simple form in codeigniter that I wish to use for the editing or records.
I am at the stage where my form is displayed and the values entered into the corresponding input boxes.
This is done by simply setting the values of said boxes to whatever they need to be in the view:
<input type="text" value="<?php echo $arti...
i have a repeater that is bound to a number of custom dataitems/types
on the itemdatabound event for the repeater the code calls a renderedit function that depending on the custom datatype will render a custom control. it will also (if validation flag is set) render a validation control for the appropriate rendered edit control
the edi...
I have a good number of regular expressions used for validation. Instead of manually typing in many addMethods for each regex, I tried using a loop. I have the below simulated struct to hold the regex name, RegExp object and validation message.
function RegExs(exprName, expr, exprVM) {
this.exprName = exprName;
this.expr = exp...
I have a suite of web tests created for a web service. I use it for testing a particular input method that updates a SQL Database. The web service doesn't have a way to retrieve the data, that's not its purpose, only to update it. I have a validator that validates the response XML that the web service generates for each request. All ...
I have asp:RegularExpressionValidator with ValidationExpression="\d+{1,4}(?:[.,]\d{1,4})?" but it doesn't' work, parser throws ArgumentException:
parsing "\d+{1,4}(?:[.,]\d{1,4})?" -
Nested quantifier {.
Where is my mistake? I want to allow strings like xxxx,xxxx - from 1 to 4 digits and decimal digits are not required, e.g.: 100...