Search Results

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

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

  • Validate subset of a form using jQuery Validate plugin

    - by Andrew Davey
    My HTML form has a number of divs that are the steps of a wizard. Upon clicking a "next" button I want to validate just the active div. I'm using the jQuery.Validate.js plugin. Each div has an ID, so I want a way to say something like: wizardForm.validate().element('#first-step :input') but this only validates the first input, not all of them. How can I validate all inputs within a div?

    Read the article

  • jquery validate plugin: add a custom method

    - by pixeline
    I need some guidance on how to add a validation method to the jquery validate plugin. I've gathered that i need to use the plugin's addMethod() function, but how exactly to have it do what i need... Here i am! My form 's first question is a radio input choice. Each radio input, if selected, shows a sub-question of several checkboxes. What i would like my validation to do is: - make sure one radio input is selected - make sure at least one checkbox pertaining to the radio input is selected. Basically, out of the validate plugin's own logic, i would count the selector's length, and if there isn't any, return the error message. Something like this: var weekSelected = ($('input.seasonSelector:checked input.weekSelector:checked',form).length > 0); if(!weekSelected){ return 'Please select a week inside that season'; } How to turn that into a validate plugin method ?

    Read the article

  • Extending Jquery validate to show/hide div or clear div after validate is ran

    - by Shawn
    Right now i have all of my errors outputting to a div. Id like to catch the validate event and clear the div right before its ran of my old errors. Then id like to show/hide that div based on if it has any labels in it that were auto generated by the jquery validation plugin. I can do everything but figure out how to extend the event, run the stuff i need to, then call the validate function. Thanks!

    Read the article

  • JQuery Validate Dynamic Table

    - by Richard
    I'm using the JQuery validation plug to validate my entire form. I also have a dynamic table on my registration page where the user can register more people. I can validate the rest of the form fine but my goal is to validate the table inputs just the same. Here is my jfiddle code: tables I don't know why the add line won't work there but it definitely works on my page. Anyway, that code ends up validate ONLY the first row of my table, but I want it to validate every single row. Can anyone see any problems with the code?

    Read the article

  • Pylons FormEncode @validate decorator pass parameters into re-render action

    - by joelbw
    I am attempting to use the validate decorator in Pylons with FormEncode and I have encountered an issue. I am attempting to validate a form on a controller action that requires parameters, and if the validation fails, the parameters aren't passed back in when the form is re-rendered. Here's an example. def question_set(self, id): c.question_set = meta.Session.query(QuestionSet).filter_by(id=id).first() c.question_subjects = meta.Session.query(QuestionSubject).order_by(QuestionSubject.name).all() return render('/derived/admin/question_set.mako') This is the controller action that contains my form. The form will add questions to an existing question set, which is identified by id. My add question controller action looks like this: @validate(schema=QuestionForm(), form='question_set', post_only=True) def add_question(self): stuff... Now, if the validation fails FormEncode attempts to redisplay the question_set form, but it does not pass the id parameter back in, so the question set form will not render. Is it possible to pass the id back in with the @validate decorator, or do I need to use a different method to achieve what I am attempting to do?

    Read the article

  • jQuery Validate() special function

    - by kevin
    I'm using the jQuery validate() plugin for some forms and it goes great. The only thing is that I have an input field that requires a special validation process. Here is how it goes: The jQuery validate plugin is called in the domready for all the required fields. Here is an example for an input: <li> <label for="nome">Nome completo*</label> <input name="nome" type="text" id="nome" class="required"/> </li> And here is how I call my special function: <li> <span id="sprytextfield1"> <label for="cpf">CPF* (xxxxxxxxxxx)</label> <input name="cpf" type="text" id="cpf" maxlength="15" class="required" /> <span class="textfieldInvalidFormatMsg">CPF Inv&aacute;lido.</span> </span> </li> And at the bottom of the file I call the Spry function: <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1","cpf"); //--> </script> Of course I call the Spry CSS and JavaScript files in the head section as well as my special-validate.js. When I just use the jQuery validate() plugin and click on the send button, the page goes automatically back to the first mistaken input field and shows the error type (not a number, not a valid email etc.). But with this new function, this "going-back-to-the-first-mistake" feature doesn't work, of course, because the validate() function sees it all good. I already added a rule for another form (about pictures upload) and it goes like this: $("#commentForm").validate({ rules: { foto34: { required: true, accept: "jpg|png|gif" } } }); Now my question is, how can I add the special validation function as a rule of the whole validation process? Here is the page to understand it better: link text and the special field is the first one: CPF. I hope I was clear explaining my problem.

    Read the article

  • Jqeury Validate() special function

    - by kevin
    Hi there, i'm using the Jquery validate() plugin for some forms and it goes great. The only thing is that i have an input field that requires a special validation process. Here is how it goes: The Jquery validate plugin is called in the domready for all the required fields. Here is an exemple for an input: <li> <label for="nome">Nome completo*</label> <input name="nome" type="text" id="nome" class="required"/> </li> And here is how i call my special function: <li> <span id="sprytextfield1"> <label for="cpf">CPF* (xxxxxxxxxxx)</label> <input name="cpf" type="text" id="cpf" maxlength="15" class="required" /> <span class="textfieldInvalidFormatMsg">CPF Inv&aacute;lido.</span> </span> </li> And at the bottom of the file i call the Spry function: <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1","cpf"); //--> </script> Of course i call the Spry css and js files in the head section as well as my special-validate.js. When i just use the Jquery validate() plugin and click on the send button, the page goes automatically back to the first mistaken input field and shows the error type (not a number, not a valid email etc.). But with this new function, this "going-back-to-the-first-mistake" feature doesnt work, of course, because the validate() function sees it all good. I already added a rule for another form (about pictures upload) and it goes like this: $("#commentForm").validate({ rules: { foto34: { required: true, accept: "jpg|png|gif" } } }); Now my question is, how can i add the special validation function as a rule of the whole validation process ? Here is the page to understand it better: link text and the special field is the first one: CPF. Hope i was clear explaining my problem. Thanks in advance. kevin

    Read the article

  • validate dynamically added textbox

    - by Hulk
    In the below code how to validate for null values for only the dynamically added text box i.e,r_score1,r_score2......... <script> function validate() { //How to validate the r_Score.. textfields } $(document).ready(function() { for(var i=0;i< sen.length;i++) { row += '<input type="text" name="r_score'+i+'" id="r_score'+r_count+'" size="8" />'; } $('#details').append(row); }); </script> <div id="details"><input type="text" name="score' id="score" size="8" /></div> <input type="button" value="Save" id="print" onclick="javascript:validate();" />

    Read the article

  • Conflict between Jquery Validate and Asp.net MVC

    - by chobo2
    Hi I am using asp.net mvc 2.0 and jquery validate 1.7 (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) What happens is this. A user can click on a link to edit a product. When a user clicks on which product they want to edit a jquery dialog box appears with a form of textboxes and dropdown lists. These html controls have information filled in them. Say if the user chooses to edit the Ipad product a dialog will appear and one of the form textboxes will have "Ipad" in it. Now this form gets rendered on the server side(the form is in a partial view). When loading the dialog box a ajax request is made to get that partial view and in the response part of the ajax call I do something like $('#EditDialog).html(ajaxresponse).dialog({...}); So I would have something like this rendered in my dialog box <form id="EditProduct"> Product Name: <input type="text" value="IPad" name="ProductName" /> </form> Now my jquery validate would be something like this. $("#EditProduct").validate( { errorContainer: "#Errorbox", errorLabelContainer: "#Errorbox ul", wrapper: "li", rules: { ProductName: "required" } }); So I know this works because I use the same validate for add product and if you try to leave ProductName blank it will show a validation error. Now it does not work with the edit one though and I think I know the reason why but not how to fix it. The value for the textbox is "IPad" this is how the Html.TextBoxFor() renders it. However if a user goes and changes the product name to "Iphone" or blank the value never changes. It is always "Ipad" in the html. So I think when the validate goes and looks it goes oh there is a value already in it. It is valid even though in reality it might be blank. When I post to the server through ajax it gets the right value and the server side validation stops it but my entire clientside validation is rendered useless because of this problem as it will never change the html.

    Read the article

  • validate that URI is valid http URI

    - by Alfred
    Hi all, My problem: First of hopefully this is not a duplicate, but I could not find the right answer(right away). I would like to validate that an URI(http) is valid in Java. I came up with the following tests but I can't get them to pass. First I used getPort(), but then http://www.google.nl will return -1 on getPort(). This are the test I want to have passed Test: @Test public void testURI_Isvalid() throws Exception { assertFalse(HttpUtils.validateHTTP_URI("ttp://localhost:8080")); assertFalse(HttpUtils.validateHTTP_URI("ftp://localhost:8080")); assertFalse(HttpUtils.validateHTTP_URI("http://localhost:8a80")); assertTrue(HttpUtils.validateHTTP_URI("http://localhost:8080")); final String justWrong = "/schedule/get?uri=http://localhost:8080&time=1000000"; assertFalse(HttpUtils.validateHTTP_URI(justWrong)); assertTrue(HttpUtils.validateHTTP_URI("http://www.google.nl")); } This is what I came up with after I removed the getPort() part but this does not pass all my unit tests. Production code: public static boolean validateHTTP_URI(String uri) { final URI u; try { u = URI.create(uri); } catch (Exception e1) { return false; } return "http".equals(u.getScheme()); } This is the first test that is failing because I am no longer validating the getPort() part. Hopefully somebody can help me out. I think I am not using the right class to validate url's?? P.S: I don't want to connect to the server to validate the URI is correct. At least not yet in this step. I only want to validate scheme.

    Read the article

  • IValidator.Validate method and adding error message to a custom type

    - by user102533
    I have several server controls that implement the IValidator interface. As such, they have their own Validate() methods that look like this. public void Validate() { this.IsValid = true; if (someConditionFails()) { ErrorMessage = "Condition failed!"; this.IsValid = false; } } I understand that these Validate() methods are executed on postback before the load completed event that is executed before the save button's event handler. What I would like to do is pass in a reference to an instance of a custom class that collects all the error messages that I can access from Save button event handler. In other words, I would like to do something like this: public void Validate(ref SummaryOfErrorMessages sum) I guess I can't do this as the signature is different from what the IValidator interface has. The other option I can think of is on Load Completed event, I would iterate through all the validators on page, get the ones with IsValid = false and create my SummaryOfErrorMessages there. Does this sound right? Is there a better way of doing it?

    Read the article

  • jQuery Validate plugin - password check - minimum requirements - Regex

    - by QviXx
    I've got a little problem with my password-checker. There's got a registration form with some fields. I use jQuery Validate plugin to validate user-inputs. It all works except the password-validation: The password should meet some minimum requirements: minimum length: 8 - I just use 'minlength: 8' at least one lower-case character at least one digit Allowed Characters: A-Z a-z 0-9 @ * _ - . ! At the moment I use this code to validate the password: $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); This Code works for the allowed characters but not for minimum requirements. I know that you can use for example (?=.*[a-z]) for a lower-case-requirement. But I just don't get it to work. If I add (?=.*[a-z]) the whole code doesn't work anymore. I need to know how to properly add the code to the existing one. Thank you for your answers! This is the complete code <script> $(function() { $("#regform").validate({ rules: { forename: { required: true }, surname: { required: true }, username: { required: true }, password: { required: true, pwcheck: true, minlength: 8 }, password2: { required: true, equalTo: "#password" }, mail1: { required: true, email: true }, mail2: { required: true, equalTo: "#mail1" } }, messages: { forename: { required: "Vornamen angeben" }, surname: { required: "Nachnamen angeben" }, username: { required: "Usernamen angeben" }, password: { required: "Passwort angeben", pwcheck: "Das Passwort entspricht nicht den Kriterien!", minlength: "Das Passwort entspricht nicht den Kriterien!" }, password2: { required: "Passwort wiederholen", equalTo: "Die Passwörter stimmen nicht überein" }, mail1: { required: "Mail-Adresse angeben", email: "ungültiges Mail-Format" }, mail2: { required: "Mail-Adresse wiederholen", equalTo: "Die Mail-Adressen stimmen nicht überein" } } }); $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); }); </script>

    Read the article

  • jQuery validate plugin radio with optional text

    - by timborden
    I'm trying to figure out how to validate a form element with a mix of radio inputs and a text input: <label>Question?</label> <input type="radio" class="mandatory" name="questions[1][]" value="1" />answer 1<br/> <input type="radio" class="mandatory" name="questions[1][]" value="2" />answer 2<br/> <input class="ignore" type="radio" id="questions[1][]" />Other (please specify)<br/> <input class="optional mandatory" type="text" name="questions[1][]" value="" /> I've figured out how to get the form to behave as expected (select and unselect) with the following code: $("input.optional").focus(function () { var this_name = $(this).attr("name"); $("input:radio").filter(function() {return $(this).attr('name') == this_name; }).attr('checked', false); $("input").filter(function() {return $(this).attr('id') == this_name; }).attr('checked', true); }); $(':radio').click(function () { var this_name = $(this).attr("name"); $("input").filter(function() {return $(this).attr('id') == this_name; }).attr('checked', false); $("input.optional").filter(function() {return $(this).attr('name') == this_name; }).val(''); }); I was hoping I could use the class "mandatory" to validate the mix of radio and text inputs: $("form .manditory").each(function () { $(this).rules("add", {required: true}); }); But it's not working as expected. With the radio (id="questions[1][]") selected, and the text input containing content, the form element is still flagged as invalid. Suggestions...maybe a better approach? Thanks in advance. UPDATE Sorry, I should have clarified that I'm using the validate plugin: $("form").validate({ ... });

    Read the article

  • jQuery Validate - can I re-validate a group of fields after changing one?

    - by Nathan Long
    I'm using jQuery Validate and would like to re-validate a group of fields whenever one of them is changed (or possibly, whenever one of them validates successfully). My attempts so far just create infinite loops. Is this possible, or does the plugin design preclude it? (Specifically, I've got a method that requires at least X of group Y to be filled out, and as soon as that's true, I'd like all those fields to re-validate. Currently I'm clearing out their error messages with my own code, but that's a hack - it also hides unrelated validation problems until the form is re-submitted.)

    Read the article

  • jQuery Validate - require at least one field in a group to be filled

    - by Nathan Long
    I'm using the excellent jQuery Validate Plugin to validate some forms. On one form, I need to ensure that the user fills in at least one of a group of fields. I think I've got a pretty good solution, and wanted to share it. Please suggest any improvements you can think of. Finding no built-in way to do this, I searched and found Rebecca Murphey's custom validation method, which was very helpful. I improved this in three ways: To let you pass in a selector for the group of fields To let you specify how many of that group must be filled for validation to pass To show all inputs in the group as passing validation as soon as one of them passes validation. So you can say "at least X inputs that match selector Y must be filled." The end result is a rule like this: partnumber: { require_from_group: [2,".productinfo"] } //The partnumber input will validate if //at least 2 `.productinfo` inputs are filled For best results, put this rule AFTER any formatting rules for that field (like "must contain only numbers", etc). This way, if the user gets an error from this rule and starts filling out one of the fields, they will get immediate feedback about the formatting required without having to fill another field first. Item #3 assumes that you're adding a class of .checked to your error messages upon successful validation. You can do this as follows, as demonstrated here. success: function(label) { label.html(" ").addClass("checked"); } As in the demo linked above, I use CSS to give each span.error an X image as its background, unless it has the class .checked, in which case it gets a check mark image. Here's my code so far: jQuery.validator.addMethod("require_from_group", function(value, element, options) { // From the options array, find out what selector matches // our group of inputs and how many of them should be filled. numberRequired = options[0]; selector = options[1]; var commonParent = $(element).parents('form'); var numberFilled = 0; commonParent.find(selector).each(function(){ // Look through fields matching our selector and total up // how many of them have been filled if ($(this).val()) { numberFilled++; } }); if (numberFilled >= numberRequired) { // This part is a bit of a hack - we make these // fields look like they've passed validation by // hiding their error messages, etc. Strictly speaking, // they haven't been re-validated, though, so it's possible // that we're hiding another validation problem. But there's // no way (that I know of) to trigger actual re-validation, // and in any case, any other errors will pop back up when // the user tries to submit the form. // If anyone knows a way to re-validate, please comment. // // For imputs matching our selector, remove error class // from their text. commonParent.find(selector).removeClass('error'); // Also look for inserted error messages and mark them // with class 'checked' var remainingErrors = commonParent.find(selector) .next('label.error').not('.checked'); remainingErrors.text("").addClass('checked'); // Tell the Validate plugin that this test passed return true; } // The {0} in the next line is the 0th item in the options array }, jQuery.format("Please fill out at least {0} of these fields.")); Questions? Comments?

    Read the article

  • jquery validate - validating a field on pageload

    - by boz
    Hi there, I've got an input field on my plain html form that I would like to be marked as invalid (and the error message shown) from the moment the page loads. Is this possible to do with the jquery validate plugin? Failing that, how can I hide an element when the plugin tries to validate a particular input field?

    Read the article

  • jQuery Validate Required Select

    - by Idsa
    I am trying to validate html select element using jQuery Validate plugin. I set "required" rule to true but it always passes validation because zero index is chosed by default. Is there any way to define empty value that is used by required rule?

    Read the article

  • jQuery plugin validate() : apply plugin to ajax injected form

    - by pixelboy
    My issue here is quite simple : i'm trying to use the jQuery validate plugin to a form that gets injected after certain user actions. My problem mostly is that : I could use live support to bind the change event over inputs, like this $("#adresseLivraisonPro").live('change',function(e){ $("#adresseLivraisonPro").validate({ But this makes my form validated if and only if user changes inputs... How would you surround that problem ?

    Read the article

  • jQuery Validate Element

    - by Idsa
    jQuery Validate plugin passes element value to inline validate functions. I'm trying to get element's id and an error telling that "element.attr is not a function" : function someFunction(element) { var elementId = element.attr('id'); } rules: { someFiled: { required: someFunction } }

    Read the article

  • jquery newbie: combine validate with hidding submit button.

    - by Jeffb
    I'm new a jQuery. I have gotten validate to work with my form (MVC 1.0 / C#) with this: <script type="text/javascript"> if (document.forms.length > 0) { document.forms[0].id = "PageForm"; document.forms[0].name = "PageForm"; } $(document).ready(function() { $("#PageForm").validate({ rules: { SigP: { required: true } }, messages: { SigP: "<font color='red'><b>A Sig Value is required. </b></font>" } }); }); </script> I also want to hide the Submit button to prevent twitchy mouse syndrome from causing duplicate entry before the controller completes and redirects (I'm using an GPR pattern). The following works for this purpose: <script type="text/javascript"> // // prevent double-click on submit // jQuery('input[type=submit]').click(function() { if (jQuery.data(this, 'clicked')) { return false; } else { jQuery.data(this, 'clicked', true); return true; } }); </script> However, I can't get the two to work together. Specifically, if validate fails after the Submit button is clicked (which happens given how the form works), then I can't get the form submitted again unless I do a browser refresh that resets the 'clicked' property. How can I rewrite the second method above to not set the clicked property unless the form validates? Thx.

    Read the article

  • jQuery Validate PHP Response

    - by Kurt
    Hello Everybody, my problem is, I want to validate an email adresse with jquery. Not only the syntax but rather if the email is already registrated. There are some tutorials but they are not working! At first the Jquery Code: <script id="demo" type="text/javascript"> $(document).ready(function() { // validate signup form on keyup and submit var validator = $("form#signupform").validate({ rules: { Vorname: { required: true, minlength: 3 }, Nachname:{ required: true, minlength: 4 }, password: { required: true, minlength: 5 }, password_confirm: { required: true, minlength: 5, equalTo: "#password" }, Email: { required: true, email: true, type: "POST", remote: "remotemail.php" }, dateformat: "required", ... </script> And now the PHP Code: <?php include('dbsettings.php'); $conn = mysql_connect($dbhost,$dbuser,$dbpw); mysql_select_db($dbdb,$conn); $auslesen1 = "SELECT Email FROM flo_user"; $auslesen2 = mysql_query($auslesen1,$conn); $registered_email = mysql_fetch_assoc($auslesen2); $requested_email = $_POST['Email']; if( in_array($requested_email, $registered_email) ){ echo "false"; } else{ echo "true"; } ?> I tried return TRUE/ return FALSE as well, but this displays "Email is registrated" all the time. json_encode didn't work as well. Thanks a lot!

    Read the article

  • Using Base SAS to validate Windows Password

    - by Bazil
    We have a signon script that requires a Windows password in order to access and validate against the SAS metadata server. The problem is that if the windows password is changed, and the script is run a few without being updated, then the user gets locked out and has to call IT support for a password reset. What is the simplest way of using Base SAS to validate a windows password? ie to enable a warning to the user if the password provided is not valid... EDIT: The concern is not whether or not this SHOULD be done, only HOW it could be done!

    Read the article

  • jQuery validate + ajaxSubmit on multiple forms

    - by demogar
    Hello there. I'm trying to validate multiple forms in one single page with the jQuery validation plugin but it validates only the first form in the page. Here is my code: $('form.reply_form').validate({ submitHandler: function(form) { $(form).ajaxSubmit(optionsReplies); return false; } }); Is for a list of reply forms in the page (image facebook). If I try to use the third form, for example, it validates the first one and if the first one is blank it wont submit. Thank you in advance.

    Read the article

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