Search Results

Search found 2674 results on 107 pages for 'validate'.

Page 14/107 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Validate checkboxes in MVC form

    - by Frode Lillerud
    Hi, I have a table in an ASP.NET MVC2 form. On each row in the table there is a checkbox. Underneath the table there is a submitbutton. I want to make the button disabled when NONE of the checkboxes are selected. <% using Html.BeginForm(....) { %> <table> <% foreach (var item in Model) { %> <tr> <td> <input type="checkbox" name="selectedContacts" /> </td></tr> <% } //End foreach %> </table> <% } //End using %> <input type="submit" value="Create selection" name="CreateSelectionAction" /> The number of lines/checkboxes will vary from 1 to many. How can I use MVC2/jQuery to require the user to selected minimum one checkbox before clicking Submit button? Edit; Of the three answers below I couldn't get any of them to work. Nothing happens when clicking the checkboxes, and no Javascript errors are raised. Setting up a small bounty.

    Read the article

  • Metalanguage like BNF or XML-Schema to validate a tree-instance against a tree-model

    - by Stefan
    Hi! I'm implementing a new machine learning algorithm in Java that extracts a prototype datastructure from a set of structured datasets (tree-structure). As im developing a generic library for that purpose, i kept my design independent from concrete data-representations like XML. My problem now is that I need a way to define a data model, which is basically a ruleset describing valid trees, against which a set of trees is being matched. I thought of using BNF or a similar dialect. Basically I need a way to iterate through the space of all valid TreeNodes defined by the ModelTree (Like a search through the search space for algorithms like A*) so that i can compare my set of concrete trees with the model. I know that I'll have to deal with infinite spaces there but first things first. I know, it's rather tricky (and my sentences are pretty bumpy) but I would appreciate any clues. Thanks in advance, Stefan

    Read the article

  • How to validate my Alexa code <noscript> tag in Head section

    - by Naveen Valecha
    The doctype and HTML tag of my page is below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-2.xsd" xmlns:og="http://ogp.me/ns#" xml:lang="en" lang="en" dir="ltr">

    Read the article

  • Display subform after validate main form

    - by bahamut100
    Hi, I want to display a new form after the validation of a form. I use Zend_Form_SubForm to do it (I Try to Zend_Form too), but this new form is not displaying. Why ?? This is the code in question : if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $subForm = new Zend_Form_SubForm(); $subForm ->setAction('') ->setMethod('post'); $nom=new Zend_Form_Element_Text('nom'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('OK'); $subForm->addElements(array($nom,$submit)); } else { $form->populate($formData); } }

    Read the article

  • MSXML2.XMLHTTP Request to validate entered URL in ASP Classic

    - by sparkyfied
    Hi guys. Thanks in advance for any help received. I want to allow our client to enter a URL into a text field which then checks whether the URL exists and works. There are 3 possible outcomes I want to check for: A status of 200 - OK, A status of 500 - Server Error, Or a status of 404 - page not found. When executing the following code in ASP classic I get a status code of 12007 when I should be getting 404. Is this because it can't find a webserver to return a code of 404? Function CheckURL(vURL) ON ERROR RESUME NEXT Set oXML=Server.CreateObject("MSXML2.XMLHTTP") : oXML.Open "POST",vURL,false : oXML.Send() CheckURL = oXML.status Set oXML = nothing End Function Or is something amiss here. What status codes am I likely to see other than the standard mentioned above.

    Read the article

  • C# regex to validate "realistic" IP values

    - by Joshua
    Regex that somewhat validates if a value has one of the following characteristics: 123-29-123-123.subdomain.zomg.com:8085 123.12.34.56:420 Unfortunately, I'm terrible at Regex, C#, google searches, and the differences between proper nouns and regular ones. It can be a lose approximation, in fact I would go with anything that has a : colon separator with a port after it.

    Read the article

  • I need a RegEx to validate not "NONE"

    - by Justin808
    I have a text field and am looking to have if be valid for all values other than "NONE" without the quotes. I know a comparison would be easy but the system I am using only validates via RegEx expressions. What would the RegEx expression be for it?

    Read the article

  • How to validate parameter values against a data source in Crystal Reports 2008

    - by mjh41
    I have a report designed in Crystal 2008. The report has a parameter field called "Member ID" that I want to use to get a string input from the user running the report. However, I want to do some sort of validation to ensure that the ID they entered is valid (it exists in a database table that I already have set up). Is there any way to do this? I know you can set up dynamic parameters that would give the user a dropdown list of Member ID values to choose from based on the data stored in my database table. But I don't want to make the user sort through thousands of IDs in a dropdown. I just want them to manually enter an ID and then have the report check the entered value against a database table. Is this possible?

    Read the article

  • Validate cyclic organization unit

    - by abmv
    I have a object Organization Unit and I have a self reference to it in the same object public class OrganizationUnit: IOrganizationUnit { private string fName; public string Name { get { return fName; } set { SetPropertyValue("Name", ref fName, (string) value); } } private OrganizationUnit fManagedBy; public IOrganizationUnit ManagedBy { get { return fManagedBy; } set { SetPropertyValue("ManagedBy", ref fManagedBy, (OrganizationUnit)value); } } } I need a method that will throw an exception if it finds a child organization unit in the third level is referencing a parent Organization unit, or to say cyclic parent organization. A is main B managed by A C

    Read the article

  • Regular exp to validate email in C

    - by Liju Mathew
    Hi, We need to write a email validation program in C. We are planning to use GNU Cregex.h) regular expression. The regular expression we prepared is [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])? But the below code is failing while compiling the regex. #include <stdio.h> #include <regex.h> int main(const char *argv, int argc) { const char *reg_exp = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"; int status = 1; char email[71]; regex_t preg; int rc; printf("The regex = %s\n", reg_exp); rc = regcomp(&preg, reg_exp, REG_EXTENDED|REG_NOSUB); if (rc != 0) { if (rc == REG_BADPAT || rc == REG_ECOLLATE) fprintf(stderr, "Bad Regex/Collate\n"); if (rc == REG_ECTYPE) fprintf(stderr, "Invalid Char\n"); if (rc == REG_EESCAPE) fprintf(stderr, "Trailing \\\n"); if (rc == REG_ESUBREG || rc == REG_EBRACK) fprintf(stderr, "Invalid number/[] error\n"); if (rc == REG_EPAREN || rc == REG_EBRACE) fprintf(stderr, "Paren/Bracket error\n"); if (rc == REG_BADBR || rc == REG_ERANGE) fprintf(stderr, "{} content invalid/Invalid endpoint\n"); if (rc == REG_ESPACE) fprintf(stderr, "Memory error\n"); if (rc == REG_BADRPT) fprintf(stderr, "Invalid regex\n"); fprintf(stderr, "%s: Failed to compile the regular expression:%d\n", __func__, rc); return 1; } while (status) { fgets(email, sizeof(email), stdin); status = email[0]-48; rc = regexec(&preg, email, (size_t)0, NULL, 0); if (rc == 0) { fprintf(stderr, "%s: The regular expression is a match\n", __func__); } else { fprintf(stderr, "%s: The regular expression is not a match: %d\n", __func__, rc); } } regfree(&preg); return 0; } The regex compilation is failing with the below error. The regex = [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])? Invalid regex main: Failed to compile the regular expression:13 What is the cause of this error? Whether the regex need to be modified? Thanks, Mathew Liju

    Read the article

  • Need to validate a scientific spreadsheet written in Java

    - by geejay
    I need a validation framework, for an app written in Java, Eclipse RCP. The UI is a simple spreadsheet with many input fields and many output fields. The user input needs to be validated, for example: Thresholds for numerical fields Required fields for certain operations Context-sensitive help based on the validation results Multi-field validation, e.g a field is valid depending upon the values in other fields Wondering if there is anything out there?

    Read the article

  • Proper way to validate model in ASP.NET MVC 2 and ViewModel apporach

    - by adrin
    I am writing an ASP.NET MVC 2 application using NHibernate and repository pattern. I have an assembly that contains my model (business entities), moreover in my web project I want to use flattened objects (possibly with additional properties/logic) as ViewModels. These VMs contain UI-specific metadata (eg. DisplayAttribute used by Html.LabelFor() method). The problem is that I don't know how to implement validation so that I don't repeat myself throughout various tiers (specifically validation rules are written once in Model and propagated to ViewModel). I am using DataAnnotations on my ViewModel but this means no validation rules are imposed on the Model itself. One approach I am considering is deriving ViewModel objects from business entities adding new properties/overriding old ones, thus preserving validation metadata between the two however this is an ugly workaround. I have seen Automapper project which helps to map properties, but I am not sure if it can handle ASP.NET MVC 2 validation metadata properly. Is it difficult to use custom validation framework in asp.net mvc 2? Do you have any patterns that help to preserve DRY in regard to validation?

    Read the article

  • How to validate an xml with repeating child elements

    - by gsk
    I have an xml document with three child elements repeating in any order. I had element in the xsd because of which the xml doesn't get validated. I can not use because the elements occur more than once. Kindly help me on this. Here is the xml <Trailer> <TrailerField name="SegmentLabelOne" length="4" type="String">TSTS</TrailerField> <TrailerField name="SegmentLabelTwo" length="2" type="String">00</TrailerField> <CountItem length="10" type="Numeric">MT</CountItem> <TrailerField name="SegmentLabelThree" length="2" type="String">01</TrailerField> <CountItem length="10" type="Numeric">MA</CountItem> <TrailerField name="SegmentLabelFour" length="2" type="String">02</TrailerField> <TrailerField name="FilerOne" length="65" type="String"> </TrailerField> </Trailer> And here is the xsd <xsd:complexType name="TrailerSegment"> <xsd:sequence> <xsd:element name="NameOfElement" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="name" type="xsd:string"></xsd:attribute> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> <xsd:element name="CountItem" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="length" type="xsd:string"></xsd:attribute> <xsd:attribute name="type" type="xsd:string"></xsd:attribute> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> <xsd:element name="TrailerField" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="name" type="xsd:string"></xsd:attribute> <xsd:attribute name="length" type="xsd:string"></xsd:attribute> <xsd:attribute name="type" type="xsd:string"></xsd:attribute> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType>

    Read the article

  • Regex validate dates like "Sun, 20 Jun 10"

    - by Trindaz
    Hi, I'm working on a regular expression that will only return true when a date string is in a format something like 'ddd, dd mmm yy'. Valid matches would be values like "Sun, 20 Jun 10" or "Mon, 21 Jun 10" but not "Sunday, 20 Jun 10" or "20 Jun 10". This will be used with mb_ereg in PHP. My attempts so far have only got me half way there. Any help appreciated! Thanks, Dave

    Read the article

  • Validate domain against LDAP?

    - by lucian.jp
    I have a procedure to get the name of the logged user show on the site. I get it this way : var winIdentity = (WindowsIdentity) HttpContext.Current.User.Identity; if (winIdentity != null) { string domainUser = winIdentity.Name.Replace(@"\", "/"); string domain = winIdentity.Name.Split('\\')[0]; string user = winIdentity.Name.Split('\\')[1]; var myDe = new DirectoryEntry(ConfigurationManager.ConnectionStrings["LDAP"].ConnectionString, ConfigurationManager.AppSettings["LDAPCredentials"].Split(';')[0], ConfigurationManager.AppSettings["LDAPCredentials"].Split(';')[1]); var deSearcher = new DirectorySearcher(myDe) {Filter = "(&(sAMAccountName=" + user + "))"}; SearchResult result = deSearcher.FindOne(); if (result != null) { DirectoryEntry userDe = result.GetDirectoryEntry(); lblNameAD.Text = string.Format(lblNameAD.Text, userDe.Properties["givenName"].Value, userDe.Properties["sn"].Value); } else { var adEntry = new DirectoryEntry("WinNT://" + domainUser); string fullname = adEntry.Properties["FullName"].Value.ToString(); lblNameAD.Text = string.Format(lblNameAD.Text, !string.IsNullOrEmpty(fullname) ? fullname : user, null); } } Probleme id that if I have a local useraccount with the same username that one from LDAP, it passes the check and return the name. EX: local\MyUser domain\MyUser Both return the name from AD even if the one from local isn't a domain account. It would be perfect if I could search in LDAP for domainuser, but it seems I can't. I also tried to restrict the DC with the DirectorySearcher but the domain name is "domain", but I only have "dc=dom" and "dc=com" and no DC for full domain name.

    Read the article

  • How to validate two properties with ASP.NET MVC 2

    - by CodeMonkey
    Hey folks :-) I'm just getting started with ASP.NET MVC 2, and playing around with Validation. Let's say I have 2 properties: Password1 Password2 And I want to require that they are both filled in, and require that both are the same before the model is valid. I have a simple class called "NewUser". How would I implement that? I've read about ValidationAttribute, and understand that. But I don't see how I would use that to implement a validation that compares two or more properties against eathother. Thanks in advance!

    Read the article

  • change validate message in data annotation

    - by user276640
    my object has field with data type int. when i put in html form in this textbox letter not number the validator say- The field must be a number. how can i change this messages like this [Required(ErrorMessage = "??????? ????????")] [DisplayName("????????")] public int age { get; set; }

    Read the article

  • Validate numeric text field in jquery

    - by mcxiand
    I have this code in jquery to prevent non-numeric characters being inputted to the text field $("#NumericField").numeric(); Now, on the text field i cant input non-numeric characters. That is OK. The problem here is if the user will paste on the text field with non numeric characters. Is there a way/method to disable pasting if the value is non-numeric? Or is there any other approach to handle this situation that you can share?

    Read the article

  • Validate uniqueness within a recent set

    - by Matchu
    Is there a standard Rails 3 way of detecting uniqueness within a particular scope, or is this custom validation all I can do? class Post < ActiveRecord::Base # [named scope for recent posts] validates do |post| if Post.recent.where('url = ?', post.url).count > 0 errors[:url] = 'has already been posted recently - thanks anyway!' end end end (Haven't yet tried that exact code, so there may be errors, but you get the idea.)

    Read the article

  • Problem with Validate Anti Forgery

    - by Mikael Egnér
    Hi! I have a problem regarding MVC Anti forgery token. When I do my authentication I have pseudo code like this: var user = userRepository.GetByEmail(email); System.Threading.Thread.CurrentPrincipal = HttpContext.Current.User = user; by doing so I'm able to get the current user in my code like this: var user = HttpContext.Current.User as EntityUser; This works fine until I add the [ValidateAntiForgeryToken] attribute to an action. When I add the attribute I get A required anti-forgery token was not supplied or was invalid. If I comment out this line: System.Threading.Thread.CurrentPrincipal = HttpContext.Current.User = user; The antiforgery validation works fine, but the I don't have my convenient way of getting my "EntityUser" from the HttpContext. Any ideas of how to work around this? Best regards Mikael

    Read the article

  • Where and how to validate and map ViewModel?

    - by chobo
    Hi, I am trying to learn Domain Driven Design and recently read that lots of people advocate creating a ViewModels for your views that store all the values you want to display in a given view. My question is how should I do the form validation? should I create separate validation classes for each view, or group them together? I'm also confused on what this would look like in code. This is how I currently think validation and viewmodels fit in to the scheme of things: View (some user input) - Controller - FormValidation(of ViewModel) - (If valid map to ViewModel to Domain Model) - Domain Layer Service - Infrastructure Thanks! P.S. I use Asp.net MVC with C#

    Read the article

  • Django formset doesn't validate

    - by tsoporan
    Hello, I am trying to save a formset but it seems to be bypassing is_valid() even though there are required fields. To test this I have a simple form: class AlbumForm(forms.Form): name = forms.CharField(required=True) The view: @login_required def add_album(request, artist): artist = Artist.objects.get(slug__iexact=artist) AlbumFormSet = formset_factory(AlbumForm) if request.method == 'POST': formset = AlbumFormSet(request.POST, request.FILES) if formset.is_valid(): return HttpResponse('worked') else: formset = AlbumFormSet() return render_to_response('submissions/addalbum.html', { 'artist': artist, 'formset': formset, }, context_instance=RequestContext(request)) And the template: <form action="" method="post" enctype="multipart/form-data">{% csrf_token %} {{ formset.management_form }} {% for form in formset.forms %} <ul class="addalbumlist"> {% for field in form %} <li> {{ field.label_tag }} {{ field }} {{ field.errors }} </li> {% endfor %} </ul> {% endfor %} <div class="inpwrap"> <input type="button" value="add another"> <input type="submit" value="add"> </div> </form> What ends up happening is I hit "add" without entering a name then HttpResponse('worked') get's called seemingly assuming it's a valid form. I might be missing something here, but I can't see what's wrong. What I want to happen is, just like any other form if the field is required to spit out an error if its not filled in. Any ideas?

    Read the article

  • NHibernate Validator - how to validate enum type

    - by Herr W.
    I'm using nhibernate validator in my current solution. Everythings is almost fine but... My view model has a property of type Gender (see example below) public virtual Gender Gender { get; set; } public enum Gender { Female = 1, Male = 2 } Now i like to have some validation to ensure that the gender property ist set. But neither the NotEmpty nor the NotNull Attribute fulfil the requirement. Is there a kind of a generic solution or best practice to handle enum validations. Thanks in advance.

    Read the article

  • Validate a URL string in my iphone app

    - by Derek
    Hi, I am getting really frustrated and I cant seem to check if the user has entered a valid url or not. This is what I have tried: NSString *str = [NSString stringWithFormat:@"%@", [myurl.text stringByAddinPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSURL *aurl = [NSURL URLWithString:urlStr[; if(aurl == nil){ //Invalid url }

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >