Search the Community
Showing results for tags 'validation'.
-
Hi All, Would like to ask whether can the drop down list in html can be control by Jquery with this condition? Each question can only rate for 3 times, the following drop box for that question should disable and not allow to make any rating. here is my HTML code: <div> <span id="questionnaire-question">Q1) Please QuestionA</span> <table> <tr style="width: 365px;"> <td><label>A1</label></td> <td> <select name="ranking[13]" class="02A" group="02A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> <tr style="width: 365px;"> <td><label>A2</label></td> <td> <select name="ranking[14]" class="02A" group="02A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> <tr style="width: 365px;"> <td><label>A3</label></td> <td> <select name="ranking[15]" class="02A" group="02A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> <tr style="width: 365px;"> <td><label>A4</label></td> <td> <select name="ranking[16]" class="02A" group="02A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> </table> </div> <div> <span id="questionnaire-question">Q2) Please QuestionB</span> <table> <tr style="width: 365px;"> <td><label>B1</label></td> <td> <select name="ranking[21]" class="03A" group="03A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> <tr style="width: 365px;"> <td><label>B2</label></td> <td> <select name="ranking[22]" class="03A" group="03A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> <tr style="width: 365px;"> <td><label>B3</label></td> <td> <select name="ranking[23]" class="03A" group="03A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> <tr style="width: 365px;"> <td><label>B4</label></td> <td> <select name="ranking[28]" class="03A" group="03A"> <option value="" >Please Rank</option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> </table> </div> Thank You.
- 1 reply
-
- jquery
- dropdownlist
-
(and 2 more)
Tagged with:
-
I need you're help with jquery form validation. I have been using jguery form validation but when I have included ckeditor on the page validation stopped working. I can't figure out why. I'm not very good with javascript so it's hard for me to figure out what is blocking it. Html form I'm using is: <form action="save_costs.php" method="POST" role="form" id="form2"> <div class="row"> <div class="col-md-12"> <div class="errorHandler alert alert-danger no-display"> <i class="fa fa-times-sign"></i> You have some form errors. Please check below. </div> <div class="successHandler alert alert-success no-display"> <i class="fa fa-ok"></i> Your form validation is successful! </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Name"; } else if ($_SESSION['language'] == "Croatian") { echo "Naziv"; } ?> <span class="symbol required"></span> </label> <input type="text" placeholder="Insert name" class="form-control" id="name" name="name" /> </div> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Description"; } else if ($_SESSION['language'] == "Croatian") { echo "Opis"; } ?> <span class="symbol required"></span> </label> <input type="text" placeholder="Insert description" class="form-control" id="description" name="description" /> </div> </div> <div class="col-md-6"> <div class="row"> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Comments"; } else if ($_SESSION['language'] == "Croatian") { echo "Komentari"; } ?> </label> <textarea class="ckeditor form-control" id="editor2" name="comment" cols="10" rows="10"></textarea> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div> <span class="symbol required"></span><?php if ($_SESSION['language'] == "English") { echo "Required Fields"; } else if ($_SESSION['language'] == "Croatian") { echo "Obavezna polja"; } ?> <hr /> </div> </div> </div> <div class="row"> <div class="col-md-8"> </div> <div class="col-md-4"> <button class="btn btn-primary btn-wide pull-right" type="submit"> <?php if ($_SESSION['language'] == "English") { echo "Submit"; } else if ($_SESSION['language'] == "Croatian") { echo "Spremi"; } ?> <i class="fa fa-arrow-circle-right"></i> </button> </div> </div> </form> Javascript file is attached. This is how I initalise form validation and CKeditor. <script src="../vendor/jquery/jquery.min.js"></script> <script src="../vendor/jquery-validation/jquery.validate.min.js"></script> <script src="../vendor/ckeditor/ckeditor.js"></script> <script src="../vendor/ckeditor/adapters/jquery.js"></script> <script src="../items/js/article_validation.js"></script> <script> <script> jQuery(document).ready(function() { Main.init(); FormValidator.init(); CKEDITOR.instances."editor2".on('blur', function(){CKEDITOR.instances."editor2".updateElement();}); }); </script> Can you, please, help me? I tried everything I thought it could block it. I don't know what to do anymore.
- 3 replies
-
- jquery
- validation
-
(and 1 more)
Tagged with:
-
Hello all, I have a form that has a number field. It gets the max and min based on another dropdown selection. Next to the number field, I have a DIV that also changes to say what the max number is for that field. Then, I have a validator that will give an error if the person enters a number outside of that range. Min is always 1, and the max changes based not the other dropdown. It looks like this: [______] (17 seats available) If there is an error: [______] (Sorry, there are {0} seats available. Please select a number of seats between 1 and {0}) This is working great, but when someone selects a valid number, then my default text of (17 seats available) goes away. This normally wouldn't be an issue, but if they decide to change that original dropdown, the default text of available seats for that dropdown doesn't re-appear. I am wondering if I can set that default text to a "valid" response, meaning that if they select a valid number then the (17 seats available) text re-appears. Here's my js validation: jQuery.validator.setDefaults({ debug: true, success: "valid" }); $( "#registration" ).validate({ rules: { availabe_seats: { required: true, max:parseInt(available_seats) } } }); jQuery.extend(jQuery.validator.messages, { max: jQuery.validator.format(" <p style=\"color:red;display:inline\"> Sorry, there are {0} seats available. Please select a number of seats between 1 and {0}.</p>"), // display error message if there are not enough seats available. This validates number field to avoid manual entries. if using the up/down dial, it will not let the user select anything above the max anyway. }); jQuery.extend(jQuery.validator.messages, { min: jQuery.validator.format(" <p style=\"color:red;display:inline\"> Sorry, you must select at least one seat.</p>"), // display error message if there are not enough seats available. This validates number field to avoid manual entries. if using the up/down dial, it will not let the user select anything above the max anyway. }); Here's my html for where it goes: <input type="number" min="" max="" step="1" value="1" name="available_seats" id="available_seats"/> <label for="available_seats" class="error" generated="true"> (<div class="in-line"><div id="display_seats_available">0</div></div> Seats Available)<br /><br /></label> I also have additional js for the min max for the number input, and that works fine. The above js is really for the people that manually enter a number instead of using the number up/down button.
-
- validation
- validator
-
(and 1 more)
Tagged with: