Search Results

Search found 14385 results on 576 pages for 'email validation'.

Page 5/576 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • JSF how to temporary disable validators to save draft

    - by Swiety
    I have a pretty complex form with lots of inputs and validators. For the user it takes pretty long time (even over an hour) to complete that, so they would like to be able to save the draft data, even if it violates rules like mandatory fields being not typed in. I believe this problem is common to many web applications, but can't find any well recognised pattern how this should be implemented. Can you please advise how to achieve that? For now I can see the following options: use of immediate=true on "Save draft" button doesn't work, as the UI data would not be stored on the bean, so I wouldn't be able to access it. Technically I could find the data in UI component tree, but traversing that doesn't seem to be a good idea. remove all the fields validation from the page and validate the data programmaticaly in the action listener defined for the form. Again, not a good idea, form is really complex, there are plenty of fields so validation implemented this way would be very messy. implement my own validators, that would be controlled by some request attribute, which would be set for standard form submission (with full validation expected) and would be unset for "save as draft" submission (when validation should be skipped). Again, not a good solution, I would need to provide my own wrappers for all validators I am using. But as you see no one is really reasonable. Is there really no simple solution to the problem?

    Read the article

  • Validation and authorization in layered architecture

    - by SonOfPirate
    I know you are thinking (or maybe yelling), "not another question asking where validation belongs in a layered architecture?!?" Well, yes, but hopefully this will be a little bit of a different take on the subject. I am a firm believer that validation takes many forms, is context-based and varies at each level of the architecture. That is the basis for the post - helping to identify what type of validation should be performed in each layer. In addition, a question that often comes up is where authorization checks belong. The example scenario comes from an application for a catering business. Periodically during the day, a driver may turn in to the office any excess cash they've accumulated while taking the truck from site to site. The application allows a user to record the 'cash drop' by collecting the driver's ID, and the amount. Here's some skeleton code to illustrate the layers involved: public class CashDropApi // This is in the Service Facade Layer { [WebInvoke(Method = "POST")] public void AddCashDrop(NewCashDropContract contract) { // 1 Service.AddCashDrop(contract.Amount, contract.DriverId); } } public class CashDropService // This is the Application Service in the Domain Layer { public void AddCashDrop(Decimal amount, Int32 driverId) { // 2 CommandBus.Send(new AddCashDropCommand(amount, driverId)); } } internal class AddCashDropCommand // This is a command object in Domain Layer { public AddCashDropCommand(Decimal amount, Int32 driverId) { // 3 Amount = amount; DriverId = driverId; } public Decimal Amount { get; private set; } public Int32 DriverId { get; private set; } } internal class AddCashDropCommandHandler : IHandle<AddCashDropCommand> { internal ICashDropFactory Factory { get; set; } // Set by IoC container internal ICashDropRepository CashDrops { get; set; } // Set by IoC container internal IEmployeeRepository Employees { get; set; } // Set by IoC container public void Handle(AddCashDropCommand command) { // 4 var driver = Employees.GetById(command.DriverId); // 5 var authorizedBy = CurrentUser as Employee; // 6 var cashDrop = Factory.CreateCashDrop(command.Amount, driver, authorizedBy); // 7 CashDrops.Add(cashDrop); } } public class CashDropFactory { public CashDrop CreateCashDrop(Decimal amount, Employee driver, Employee authorizedBy) { // 8 return new CashDrop(amount, driver, authorizedBy, DateTime.Now); } } public class CashDrop // The domain object (entity) { public CashDrop(Decimal amount, Employee driver, Employee authorizedBy, DateTime at) { // 9 ... } } public class CashDropRepository // The implementation is in the Data Access Layer { public void Add(CashDrop item) { // 10 ... } } I've indicated 10 locations where I've seen validation checks placed in code. My question is what checks you would, if any, be performing at each given the following business rules (along with standard checks for length, range, format, type, etc): The amount of the cash drop must be greater than zero. The cash drop must have a valid Driver. The current user must be authorized to add cash drops (current user is not the driver). Please share your thoughts, how you have or would approach this scenario and the reasons for your choices.

    Read the article

  • jquery form validation: validation script specified externally

    - by Abu Hamzah
    i have a jquery form validation in the master page and it works fine and i got that working from this article: http://www.dotnetcurry.com/ShowArticle.aspx?ID=310 my question is: if i place the .js to external and add a reference to my page then its not working... it says object expected here is how i have done: in my content page (i am using master page, asp.net ) add in my content page: <script src="myform_validation.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { ValidateMe(this); }); </script> below is in the external .js file: function ValidateMe() { $("#aspnetForm").validate({ rules: { <%=TextBox1.UniqueID %>: { maxlength:1, //minlength: 12, required: true }, <%=TextBox2.UniqueID %>: { minlength: 12, required: true }, <%=TextBox3.UniqueID %>: { minlength: 12, required: true }//, // }, messages: { <%=TextBox1.UniqueID %>: { required: "Enter your firstname", minlength: jQuery.format("Enter at least {0} characters") }, <%=TextBox2.UniqueID %>: { required: "Please enter a valid email address", minlength: "Please enter a valid email address" } , <%=TextBox3.UniqueID %>: { required: "Enter your firstname", minlength: jQuery.format("Enter at least {0} characters") } } , success: function(label) { // set &nbsp; as text for IE label.html("&nbsp;").addClass("checked"); } }); } ;

    Read the article

  • automatic manipulation of email messages

    - by Toc
    Does it exist any web service that "filters" any email message allowing to change the subject or the content on a regexp basis and then forward it to my webmail address? For example: I want to append automatically the string "IMPORTANT! " to the subject of every message I receive with the subject containing "expiry", or I want to change any occurrence of "h2" in the body to "h1".

    Read the article

  • unable to receiving emails to my client.

    - by Karthik Malla
    Hello, I created my own mail server client my domain name is www.softmail.me from this mail client I can able to send emails to any email provider but I cannot receive any emails back. I hosted my client at http://beta.softmail.me do I need to apply settings of a sub domain or domain settings are enough. Kindly check my dns settings and reply me. my DNS details are A (Host) host = @ points = 65.75.241.26 host = beta points = 65.75.241.26 host = accs points = 65.75.241.26 host = mail points = 65.75.241.26 host = stable points = 65.75.241.26 CNAME (Alias) host = imap points = mail host = pop points = mail host = smtp points = mail host = www points = @ MX (Mail Exchange) priority = 10 host = mail points = @ Please verify the above settings and tell me why I am unable to receive emails back from other email providers.

    Read the article

  • jQuery Templates - XHTML Validation

    - by hajan
    Many developers have already asked me about this. How to make XHTML valid the web page which uses jQuery Templates. Maybe you have already tried, and I don't know what are your results but here is my opinion regarding this. By default, Visual Studio.NET adds the xhtml1-transitional.dtd schema <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> So, if you try to validate your page which has jQuery Templates against this schema, your page won't be XHTML valid. Why? It's because when creating templates, we use HTML tags inside <script> ... </script> block. Yes, I know that the script block has type="text/html" but it's not supported in this schema, thus it's not valid. Let's try validate the following code Code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>     <title>jQuery Templates :: XHTML Validation</title>     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script>     <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js" type="text/javascript"></script>          <script language="javascript" type="text/javascript">         $(function () {             var attendees = [                 { Name: "Hajan", Surname: "Selmani", speaker: true, phones: [070555555, 071888999, 071222333] },                 { Name: "Denis", Surname: "Manski", phones: [070555555, 071222333] }             ];             $("#myTemplate").tmpl(attendees).appendTo("#attendeesList");         });     </script>     <script id="myTemplate" type="text/html">          <li>             ${Name} ${Surname}             {{if speaker}}                 (<font color="red">speaks</font>)             {{else}}                 (attendee)             {{/if}}         </li>     </script>      </head>     <body>     <ol id="attendeesList"></ol> </body> </html> To validate it, go to http://validator.w3.org/#validate_by_input and copy paste the code rendered on client-side browser (it’s almost the same, only the template is rendered inside OL so LI tags are created for each item). Press CHECK and you will get: Result: 1 Errors, 2 warning(s)  The error message says: Validation Output: 1 Error Line 21, Column 13: document type does not allow element "li" here <li> Yes, the <li> HTML element is not allowed inside the <script>, so how to make it valid? FIRST: Using <![CDATA][…]]> The first thing that came in my mind was the CDATA. So, by wrapping any HTML tag which is in script blog, inside <![CDATA[ ........ ]]> it will make our code valid. However, the problem is that the template won't render since the template tags {} cannot get evaluated if they are inside CDATA. Ok, lets try with another approach. SECOND: HTML5 validation Well, if we just remove the strikethrough part bellow of the !DOPCTYPE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> our template is going to be checked as HTML5 and will be valid. Ok, there is another approach I've also tried: THIRD: Separate template to an external file We can separate the template to external file. I didn’t show how to do this previously, so here is the example. 1. Add HTML file with name Template.html in your ASPX website. 2. Place your defined template there without <script> tag Content inside Template.html <li>     ${Name} ${Surname}     {{if speaker}}         (<font color="red">speaks</font>)     {{else}}         (attendee)     {{/if}} </li> 3. Call the HTML file using $.get() jQuery ajax method and render the template with data using $.tmpl() function. $.get("/Templates/Template.html", function (template) {     $.tmpl(template, attendees).appendTo("#attendeesList"); }); So the complete code is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>     <title>jQuery Templates :: XHTML Validation</title>     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script>     <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js" type="text/javascript"></script>          <script language="javascript" type="text/javascript">         $(function () {             var attendees = [                 { Name: "Hajan", Surname: "Selmani", speaker: true, phones: [070555555, 071888999, 071222333] },                 { Name: "Denis", Surname: "Manski", phones: [070555555, 071222333] }             ];             $.get("/Templates/Template.html", function (template) {                 $.tmpl(template, attendees).appendTo("#attendeesList");             });         });     </script>      </head>     <body>     <ol id="attendeesList"></ol> </body> </html> This document was successfully checked as XHTML 1.0 Transitional! Result: Passed If you have any additional methods for XHTML validation, you can share it :). Thanks,Hajan

    Read the article

  • Simple PHP form Validation and the validation symbols

    - by Cool Hand Luke UK
    Hi have some forms that I want to use some basic php validation (regular expressions) on, how do you go about doing it? I have just general text input, usernames, passwords and date to validate. I would also like to know how to check for empty input boxes. I have looked on the interenet for this stuff but I haven't found any good tutorials. Thanks

    Read the article

  • Step by Step validation with jquery validation plugin

    - by Alex
    I know its been asked many times already but no one could come up with solution so far. The idea is to have one form separated into few steps and validate each step on next click of the button. I know jquery validation plugin is offering quite complicated way of doing it with accordion but can anyone come up with a simple solution something like var stepOne = { rules: { fieldname1: "required", fieldname2: "required", } } $("form").validate(stepOne); //onclick hope someone could suggest the best way of doing it. Thanks.

    Read the article

  • Why Freezing when sending email?

    - by Outlaw Lemur
    So i have a kinect program which when it detects a human, it saves images of them and sends your email a notification email, the thing is that when it sends the email, it freezes and stops running, Why does it do this? Email Notification Code: void SendNotificationEmail() { string email = textBox1.Text; string message = "Someone has been detected in your house!\n Go to www.kinected.webs.com to view your photos now!!!!"; System.Net.Mail.MailMessage emailsend = new System.Net.Mail.MailMessage(); emailsend.To.Add(email); emailsend.Subject = "There is an Intruder In Your Home!"; emailsend.From = new System.Net.Mail.MailAddress("[email protected]"); emailsend.Body = message; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.mail.yahoo.com."); smtp.Send(emailsend); } When its supposed to fire: void nui_ColorFrameReady2(object sender, ImageFrameReadyEventArgs e) { // 32-bit per pixel, RGBA image xxx PlanarImage Image = e.ImageFrame.Image; //int deltaFrames = totalFrames - lastFrameWithMotion; //if (totalFrames2 <= stopFrameNumber & deltaFrames > 300) { ++totalFrames2; string bb1 = Convert.ToString(totalFrames2); // string file_name_3 = "C:\\Research\\Kinect\\Proposal\\Depth_Img" + bb1 + ".jpg"; xxx string file_name_4 = "C:\\temp\\Kinect1_Img" + bb1 + ".jpg"; video.Source = BitmapSource.Create( Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel); BitmapSource image4 = BitmapSource.Create( Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel); if (PersonDetected == 1) { if (totalFrames2 % 10 == 0) { image4.Save(file_name_4, Coding4Fun.Kinect.Wpf.ImageFormat.Jpeg); SendNotificationEmail(); PersonDetected = 0; // lastFrameWithMotion = totalFrames; // topFrameNumber += 100; } } } } Thanks for any help!

    Read the article

  • How does eMail encryption work?

    - by Dummy Derp
    I have been going over YouTube watching videos on eMail encryption and everyone seems to explain it from a different perspective. Some do it for a CompTIA exam while others just provide a primer. Here is what I understood: Step1: You compose an email that you want to send. Without encryption, it will be simple ASCII text that will be visible to anyone along the way. Step2: You generate a digital signature to make sure that nobody gets to re-transmit your email and claim it was you. Digital Signature is generated using Sender's private key which is usually a hash of the password and is then combined with the original message to form one long hash string. These signatures are one-time-use-only and a new one is calculated for every email. Step 3: You encrypt the compose of your email using Receiver's public key so that the only person who can read it is the intended receiver using their private key Step 4: When you hit the send the email, what is transmitted now is gibberish to everyone apart from the intended receiver who will decrypt is using their private key And there are various ways to do it like PEM, PGP, etc. Correct me where I am wrong or refine where necessary.

    Read the article

  • Configure Hibernate validation for bean

    - by sergionni
    Hi. I need to perform validation based on SQL query result. Query is defined as annotation - as @NamedQuery in my entity bean. According to Hibernate documentation(doc), there is possibility to validate bean on following operations: pre-update pre-insert pre-delete looks like: <hibernate-configuration> <session-factory> ... <event type="pre-update"> <listener class="org.hibernate.cfg.beanvalidation.BeanValidationEventListener"/> </event> <event type="pre-insert"> <listener class="org.hibernate.cfg.beanvalidation.BeanValidationEventListener"/> </event> <event type="pre-delete"> <listener class="org.hibernate.cfg.beanvalidation.BeanValidationEventListener"/> </event> </hibernate-configuration> The question is how to connect my bean with the validation configuration, described above.

    Read the article

  • Using unless in rails uniqueness validation

    - by dunxd
    I am just starting out in Rails, and trying to develop a simple application. I need to validate three values submitted to the application - each must meet the same validation criteria. The validation is pretty simple: Value is valid if unqiue, null or equal to "p" or "d". The following gets me halfway there: validates_uniqueness_of :value1, :value2, :value3, :allow_nil => true I think I can use :unless to check whether the value is either "p" or "d", however I can't figure out how. I guess I am trying to combine validates_uniqueness_of with validates_inclusion_of. Any suggestions?

    Read the article

  • Rails group validation with just one error message

    - by Victor
    The following validation code in the model: validates :formatted_address, :zip, :city, :state, :country, :presence => true, :message => "is incomplete. Please enter full address." is displayed when either of the fields are empty. Let's say now :address and country are empty, 2 errors are displayed: Formatted Address is incomplete. Please enter full address. Country is incomplete. Please enter full address. How can I group the error message in the validation to just show one error message if either of the fields validated does not exist? Address is incomplete. Please enter full address. Thanks.

    Read the article

  • Best practices for mass email platform

    - by Niro
    I am in the process of setting up mass email service. My question is: what are the best practices to achieve maximum deliver-ability. More precisely - what should I do/know to prevent spam filters from blocking the emails (the emails are not spam). for example- how can I tell if my IP address is blacklisted somewhere and how can I prevent it from becoming blacklisted. Is amazon web services a suitable platform due to dynamic IP addresses, what are the restrictions on the from address, can it be different from the mail server domain.... you get it....

    Read the article

  • Email bouces to tell me it was delivered?

    - by flamey
    I get this back after sending an email. It says "Your message was successfully delivered", then why do I even get this? Or this phrase referes to something else? Reporting-MTA: dns; gmmr6.centrum.cz X-Postfix-Queue-ID: CDBBB8016CE1 X-Postfix-Sender: rfc822; [SENDER_EMAIL] Arrival-Date: Sat, 5 Mar 2011 22:04:41 +0100 (CET) Final-Recipient: rfc822; [RECIPIENT_EMAIL] Original-Recipient: rfc822;[RECIPIENT_EMAIL] Action: delivered Status: 2.0.0 Diagnostic-Code: X-Postfix; delivery via maildaemon: OK This is the mail system at host gmmr6.centrum.cz. Your message was successfully delivered to the destination(s) listed below. If the message was delivered to mailbox you will receive no further notifications. Otherwise you may still receive notifications of mail delivery errors from other systems. The mail system <[RECIPIENT_EMAIL]>;: delivery via maildaemon: OK

    Read the article

  • How much data validation is too much? [closed]

    - by adbertram
    Possible Duplicate: Data input validation - Where? How much? I'm a new PHP developer and am into Powershell quite a bit but this question is language agnostic. I've been questioning my code quite a bit lately thinking about how many nets I should setup to catch exceptions, verify results, etc. I realize that I could go crazy trying to verify each and every line of code but at the same time I want the code as resilient as possible. I'm not talking about user input but verifying output from methods. Is there some standard or rule of thumb to go by when deciding when and where to do data validation?

    Read the article

  • Validation and Verification explanation (Boehm) - I cannot understand its point

    - by user970696
    Hopefully my last thread about V&V as I found the B.Boehm is text which I just do not understand well (likely my technical English is not that good). http://csse.usc.edu/csse/TECHRPTS/1979/usccse79-501/usccse79-501.pdf Basically he says that verification is about checking that products derived from requirements baseline must correspond to it and that deviation leads only to changes in these derived products (design, code). But he says it begins with design and ends with acceptance tests (you can check the V model inside). The thing is, I have accepted ISO12207 in terms of all testing is validation, yet it does not make any sense here. In order to be sure the product complies with requirements (acceptance test) I need to test it. Also it says that validation problems means that requirements are bad and needs to be changed - which does not happen with testing that testers do, who just checks correspondence with requirements.

    Read the article

  • jQuery validation per multiple fieldsets, how to use different event to trigger validation per secti

    - by Jesse
    Hi All! I have a really, really long form (about 300 fields) that I broke down into different sections using this slick jQuery plugin Form Wizard. If you group your form into different fieldsets, the FormWizard will automagically display one section at a time, with a Next hyperlink to take you to the next section: <a id="step0Next" class="next" href="#">Next ></a> My question is this: Using the jQuery Validation plugin, how can I validate each fieldset when a user clicks Next, and so forth, instead of using the Submit button. Put differently, how can I change the trigger event from Submit to six different hyperlinks for six separate sections? Thanks for helping this newb out.

    Read the article

  • Conditional Validation using JQuery Validation Plugin

    - by Steve Kemp
    I have a simple html form that I've added validation to using the JQuery Validation plugin. I have it working for single fields that require a value. I now need to extend that so that if a user answers Yes to a question they must enter something in the Details field, otherwise the Details field can be left blank. I'm using radio buttons to display the Yes/No. Here's my complete html form - I'm not sure where to go from here: <script type="text/javascript" charset="utf-8"> $.metadata.setType("attr", "validate"); $(document).ready(function() { $("#editRecord").validate(); }); </script> <style type="text/css"> .block { display: block; } form.cmxform label.error { display: none; } </style> </head> <body> <div id="header"> <h1> Questions</h1> </div> <div id="content"> <h1> Questions Page 1 </h1> </div> <div id="content"> <h1> </h1> <form class="cmxform" method="post" action="editrecord.php" id="editRecord"> <input type="hidden" name="-action" value="edit"> <h1> Questions </h1> <table width="46%" class="record"> <tr> <td width="21%" valign="top" class="field_name_left"><p>Question 1</p></td> <td width="15%" valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question1" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question1" value="No" /> No </label> <label for="Question1" class="error">You must answer this question to proceed</label> </td> <td width="64%" valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details1" class="where" name="Details1" cols="25" rows="2"></textarea></td> </tr> <tr> <td valign="top" class="field_name_left">Question 2</td> <td valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question2" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question2" value="No" /> No </label> <label for="Question2" class="error">You must answer this question to proceed</label> </td> <td valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details2" class="where" name="Details2" cols="25" rows="2"></textarea> </td> </tr> <tr class="submit_btn"> <td colspan="3"> <input type="submit" name="-edit" value="Finish"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </form> </div> </body> </html>

    Read the article

  • non-latin email address validation

    - by Eric Di Bari
    Now that ICann is allowing non-latin-character domain names, should I be concerned about e-mail validation? Currently, my sites are using php functions to ensure some alpha-numeric character set in each segment of an email address. Will these other character sets, such as Cyrillic, Arabic, and Chinese, pass validation? Are there recommended php functions to utilize for this?

    Read the article

  • jQuery Validation Plugin: Invoke errorPlacement function when onfocusout, keyup and click

    - by th3hamburgler
    Hi, I am using the jquery validation plugin and want to use the errorPlacement function to add error messages to the fields title attribute and display just a ? next to the field. This works great when the form is submitted with the submit button but when any of the following events are triggered: - onfocusout - click - onkeyup The validation checks are run but it skips the errorPlacement function and adds the full error message after the field, like the default behaviour. I am using the following code: $("#send-mail").validate({ debug: true, // set this class to error-labels to indicate valid fields success: function(label) { // set text as tick label.html("&#10004;").addClass("valid"); }, // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { console.log("errorPlacement called for "+element.attr("name")+" field"); // check for blank/success error if(error.text() == "") { // remove field title/error message from element element.attr("title", ""); console.log("error check passed"); } else { // get error message var message = error.text(); // set as element title element.attr("title", message); // clear error html and add cross glyph error.html("&#10008;"); console.log("error check failed: "+message); } // add error label after form element error.insertAfter(element); }, ignoreTitle: true, errorClass: "invalid" });

    Read the article

  • Rails: Getting rid of "X is invalid" validation errors

    - by DJTripleThreat
    I have a sign-up form that has nested associations/attributes whatever you want to call them. My Hierarchy is this: class User < ActiveRecord::Base acts_as_authentic belongs_to :user_role, :polymorphic => true end class Customer < ActiveRecord::Base has_one :user, :as => :user_role, :dependent => :destroy accepts_nested_attributes_for :user, :allow_destroy => true validates_associated :user end class Employee < ActiveRecord::Base has_one :user, :as => :user_role, :dependent => :destroy accepts_nested_attributes_for :user, :allow_destroy => true validates_associated :user end I have some validation stuff in these classes as well. My problem is that if I try to create and Customer (or Employee etc) with a blank form I get all of the validation errors I should get plus some Generic ones like "User is invalid" and "Customer is invalid" If I iterate through the errors I get something like: user.login can't be blank User is invalid customer.whatever is blah blah blah...etc customer.some_other_error etc etc Since there is at least one invalid field in the nested User model, an extra "X is invalid" message is added to the list of errors. This gets confusing to my client and so I'm wondering if there is a quick way to do this instead of having to filer through the errors myself.

    Read the article

  • Rails: Getting rid of generic "X is invalid" validation errors

    - by DJTripleThreat
    I have a sign-up form that has nested associations/attributes whatever you want to call them. My Hierarchy is this: class User < ActiveRecord::Base acts_as_authentic belongs_to :user_role, :polymorphic => true end class Customer < ActiveRecord::Base has_one :user, :as => :user_role, :dependent => :destroy accepts_nested_attributes_for :user, :allow_destroy => true validates_associated :user end class Employee < ActiveRecord::Base has_one :user, :as => :user_role, :dependent => :destroy accepts_nested_attributes_for :user, :allow_destroy => true validates_associated :user end I have some validation stuff in these classes as well. My problem is that if I try to create and Customer (or Employee etc) with a blank form I get all of the validation errors I should get plus some Generic ones like "User is invalid" and "Customer is invalid" If I iterate through the errors I get something like: user.login can't be blank User is invalid customer.whatever is blah blah blah...etc customer.some_other_error etc etc Since there is at least one invalid field in the nested User model, an extra "X is invalid" message is added to the list of errors. This gets confusing to my client and so I'm wondering if there is a quick way to do this instead of having to filer through the errors myself.

    Read the article

  • Manually wiring up unobtrusive jquery validation client-side without Model/Data Annotations, MVC3

    - by cmorganmcp
    After searching and experimenting for 2 days I relent. What I'd like to do is manually wire up injected html with jquery validation. I'm getting a simple string array back from the server and creating a select with the strings as options. The static fields on the form are validating fine. I've been trying the following: var dates = $("<select id='ShiftDate' data-val='true' data-val-required='Please select a date'>"); dates.append("<option value=''>-Select a Date-</option>"); for (var i = 0; i < data.length; i++) { dates.append("<option value='" + data[i] + "'>" + data[i] + "</option>"); } $("fieldset", addShift).append($("<p>").append("<label for='ShiftDate'>Shift Date</label>\r").append(dates).append("<span class='field-validation-valid' data-valmsg-for='ShiftDate' data-valmsg-replace='true'></span>")); // I tried the code below as well instead of adding the data-val attributes and span manually with no luck dates.rules("add", { required: true, messages: { required: "Please select a date" } }); // Thought this would do it when I came across several posts but it didn't $.validator.unobtrusive.parse(dates.closest("form")); I know I could create a view model ,decorate it with a required attribute, create a SelectList server-side and send that, but it's more of a "how would I do this" situation now. Can anyone shed light on why the above code wouldn't work as I expect? -chad

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >