I have Two dropdown boxes, if i select 4 from first select box, the value of the second dropdown value must be less than the first dropdown. if it fails show a custom error message, like that.  &lt;select name="t_dropdown" id="t_dropdown" class="form-control required"&gt;   &lt;option value=""&gt;Select Value&lt;/option&gt;   &lt;option value="1"&gt;1&lt;/option&gt;   &lt;option value="2"&gt;2&lt;/option&gt;   &lt;option value="3"&gt;3&lt;/option&gt;   &lt;option value="4"&gt;4&lt;/option&gt;   &lt;option value="5"&gt;5&lt;/option&gt; &lt;/select&gt;  &lt;select name="p_dropdown" id="p_dropdown" class="form-control required"&gt;   &lt;option value=""&gt;Select Value&lt;/option&gt;   &lt;option value="1"&gt;1&lt;/option&gt;   &lt;option value="2"&gt;2&lt;/option&gt;   &lt;option value="3"&gt;3&lt;/option&gt;   &lt;option value="4"&gt;4&lt;/option&gt;   &lt;option value="5"&gt;5&lt;/option&gt;   &lt;option value="6"&gt;6&lt;/option&gt;   &lt;option value="&gt;6"&gt;&gt;6&lt;/option&gt; &lt;/select&gt;   Please let me know, how to do it using jquery validations.
11336
How do you create a simple, custom rule using the jQuery Validate plugin (using ) that doesn't use a regex?  For example, what function would create a rule that validates only if at least one of a group of checkboxes is checked?
73235
Usually, dropdown menus are made as long as their longest value. However, that works well only for dropdowns with a predefined set of values. How can we deal with a dropdown that receives its values dynamically and displays user-generated values which don't have a reasonable size limit? For example a file name may be extremely long. I'm looking for a way to solve this which would still let me use the dropdown in a reasonable way (e.g. without having to always place it in its own row for fear that it might grow and mess with my layout).   Truncating values at a low cutoff point won't work well since the difference between the values might be at the last characters (again, the file extensions example is a good one). I can use it for the edge cases, but I'd like to get there as late as possible.
83460
I have a page where a few textboxes cannot be empty before clicking a Save button.    &lt;TextBox...                  &lt;TextBox.Text&gt;                     &lt;Binding Path ="LastName" UpdateSourceTrigger="PropertyChanged"&gt;                          &lt;Binding.ValidationRules&gt;                             &lt;local:StringRequiredValidationRule /&gt;                         &lt;/Binding.ValidationRules&gt;                                                   &lt;/Binding&gt;                 &lt;/TextBox.Text&gt;   My rule works, I have a red border around my textbox until I enter a value.  I now want to add this validation rule to my other text boxes.  How do I disable the Save button until the page has no validation errors?  I'm not sure what to check.
60861
I have an AJAX button that should update form fields according to data already provided by user:   'ajax_button' =&gt; array(     '#type' =&gt; 'button',     '#value' =&gt; t("Scan for tags"),     '#ajax' =&gt; array(       'callback' =&gt; 'ajax_tag',       'wrapper' =&gt; 'dynamic-tags-fieldset',       'method' =&gt; 'replace',       'event' =&gt; 'click',       'prevent' =&gt; 'submit click mousedown',     ),   ),   It works, but only if form is valid. Of course I do not want to validate it just yet. I don't care if all fields are filled, I only need my form to be updated at this very moment. How can I make form api not to invoke hook_form_validate() and not test #required fields?
12135
I want to iterate through a dropdown, select the first value, then click search, then again select the second value and again perform search.In this code i have tried selecting only one option,but I want to perform search on all the options one by one
67449
I have a view that has three expose filters (Manufacturer, Type, Model), three options list (term reference to Printer vocabulary) .  Vocabulary: Printer (3 levels)   -- HP            ---- xxx      ------ xxxx   -- Apple ---- xxxx ------ xxxxxx -- Dell ---- xxxx ------- xxxxx -- ... -- ... (thousands of terms)   Since Form API AJAX doesn't work on views expose form, I am unable to make the them dependent select for exposed form fields. So I used jQuery to make the exposed form fields "dependent select / cascading select".    Basically, I empty all the options in views_exposed_form_alter() firstly:  $form['manufacturer_id']['#options'] = $form['type_id']['#options'] = $form['model_id']['#options'] = array();   then populate the option lists with my jQuery code accordingly.  However I get "An illegal choice has been detected." on page load, and form submit.  Form submission is prevented due to Drupal form validation mechanism .    It's the form validation detect the options generated by jQuery are not come with the original form data, as I removed the options in form alter. Value of a select box is not present in its defined options .  So I tried to remove form validation in form alter as:  unset($form['#validate']);   still doesn't work, the illegal choice error remains.  ============ UPDATED =================  Inspired by @kiamlaluno 's answer below, the only solution I came up is hack/patch the core.  Here is what I done:  Edited /includes/form.inc : (line 2014)    I removed the code:  $element['#needs_validation'] = TRUE;   and added:  // if not these fields, mark for validation as usual.  // so if are these fields, validation will be passed.   if ($element['#name'] != 'manufacturer_id'  &amp;&amp;      $element['#name'] != 'type_id'          &amp;&amp;      $element['#name'] != 'model_id' ) {    $element['#needs_validation'] = TRUE; }   It works, the exposed form select option bypassed the validation.   But my solution is very ugly which modified the core.   I wonder if there is any other solution without touching the core? How can I bypass the validation of these exposed form fields?  Thanks!
60853
For context: This is a desktop application interacting with a service running on W7.  I'll try and leave all the technical details out of this, but here goes:  Part of my application has to send a large amount of data to the server which is then validated server side. Any errors found are sent back to the client to handle.  My 'problem' is that this large amount of data (in this case, a person) can have a lot of things 'wrong with it' which can be summarised into two main errors:   Required fields not being filled in. (Name not provided) Data being entered but still invalid due to a business rule (person is under the age of 18, phone number entered as ABC123, assessment was completed, but no completion date was entered, etc.)   Now even with all the client side validation I can put in, there still might be cases when a number of errors that aren't detected. (business rules, mostly) How should these errors be displayed to the client? I only see three real options here:   Displaying the server side errors into the UI somehow. I'd like to avoid this possible since I'm not 100% sure on how to code this without writing a mass of spaghetti code to determine which error is for which field. List one error at a time. When a user submits the data, show the first error that is returned and ignore all the others. When the user resubmits, shows the next one, and so on. I have a feeling this could annoy some people who will probably send me angry emails along the lines of 'Why don't you show me all the errors at once?!?!?' Show them all at once. I could have all the errors showing at once, but this is going to cause a few problems:   The dialog box should potentially be huge if they've somehow got 15 or so errors. No one is going to remember all 15 problems unless they screenshot the message or write them down. The API on Windows might not allow me to fit all message in one dialog leaving users to click through an unknown amount of dialogs.    How should I approach this?
7648
I want to add a "Select One" option to a drop down list bound to a List&lt;T&gt;.   Once I query for the List&lt;T&gt;, how do I add my initial Item, not part of the data source, as the FIRST element in that List&lt;T&gt; ?  I have:  // populate ti from data                List&lt;MyTypeItem&gt; ti = MyTypeItem.GetTypeItems();     //create initial entry     MyTypeItem initialItem = new MyTypeItem();     initialItem.TypeItem = "Select One";     initialItem.TypeItemID = 0; ti.Add(initialItem)  &lt;!-- want this at the TOP!     // then      DropDownList1.DataSource = ti;
11153
I am getting above ugly error.How to clean the error without custom error handing in controller.  &lt;apex:page standardController="Account" extensions="EventController"&gt;  &lt;apex:form &gt; &lt;apex:pageMessages&gt;&lt;/apex:pageMessages&gt; &lt;apex:pageBlock &gt; &lt;p&gt; Please select  &lt;/p&gt; &lt;apex:selectRadio value="{!selectType}" required="true"&gt;  &lt;apex:selectOptions value="{!Option}"/&gt; &lt;/apex:selectRadio&gt; &lt;apex:commandButton value="Next" action="{!next}"/&gt; &lt;/apex:pageBlock&gt; &lt;/apex:form&gt; &lt;/apex:page&gt;
106972
As the question says, how do I set the value of a DropDownList control using jQuery?
121274
I'm using Drupal seven. I want to make the options in a select list be dependent on the value chosen in another select list in a form.  I'm sure this has been asked many times before, but I am having difficulty finding a clear answer for how to do this.  The form is for users to enter a work history.  They need to select a squadron which is a node reference to the squadron field type, and this is in a drop-down list.  However, the squadron, is dependent upon a city drop-down list.  Users first need to select a city which will then filter the options for the squadron.  In the squadron content type, I created a taxonomy for city which gets tagged to the squadron.  I would be very grateful for any pointers as to the best way (simplest?) to go about this, or for any useful resources online which would help.
72166
I have some HTML and jQuery that slides a div up and down to show or hide` it when a link is clicked:  &lt;ul class="product-info"&gt;   &lt;li&gt;     &lt;a href="#"&gt;YOU CLICK THIS TO SHOW/HIDE&lt;/a&gt;     &lt;div class="toggle"&gt;       &lt;p&gt;CONTENT TO SHOW/HIDE&lt;/p&gt;     &lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;   $('div.toggle').hide(); $('ul.product-info li a').click(function(event){   $(this).next('div').slideToggle(200); }   My question is: How do I use preventDefault() to stop the link acting as a link and adding "#" to the end of my URL &amp; jumping to the top of the page?  I can't figure out the right syntax, I just keep getting an error saying      preventDefault() is not a function.
13613
When I try to use multiple , the message box text is the concatenated text of all the tags, as if it is one tag.        In this case the correct form could be the next:     The 'a', 'the', 'or', 'on' tags are not allowed.
83296
I am using the  validation plugin. Great stuff! I want to migrate my existing ASP.NET solution to use jQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator. I want to be able to do something like this:  $("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s]{1,40}$" })   How do I add a custom rule to achieve this?
74715
I have several input and option elements on my page, each (well almost) have an event attached to update some text on the page once they change. I use jQuery which is really really cool :)   I also use Microsofts  framework, utilizing the UpdatePanel. The reason why I do that is that certain elements are created on the page based on some server-side logic. I don't really want to explain why I use the UpdatePanel - even if it could (it can with quite some effort) be rewritten to use only  I still want that UpdatePanel.  You probably guessed it - once I have a postback on the UpdatePanel the jQuery events stops working. I actually was expecting this, since the "postback" is not really a new postback so my code in document.ready that binds the events won't be fired again. I also confirmed my suspicion by reading up on it in the jQuery help libraries.  Anyway I'm left with the problem of rebinding my controls after the UpdatePanel is done updating the . I preferably need a solution that does not require adding more .js files (jQuery plug-ins) to the page but something as simple as being able to catch the UpdatePanel's 'afterupdating' where I can just call my method to rebind all the form elements.
67748
I have a simple html block like:  &lt;span id="replies"&gt;8&lt;/span&gt;   Using jquery I'm trying to add a 1 to the value (8).  var currentValue = $("#replies").text(); var newValue = currentValue + 1; $("replies").text(newValue);   What's happening is it is appearing like:  81  then  811  not 9, which would be the correct answer.  What am I doing wrong?
19582
If I set a CSS value on a specific element using:  $('#element').css('background-color', '#ccc');   I want to be able to unset that element-specific value and use the cascaded value, along the lines of:  $('#element').css('background-color', null);   But that syntax doesn't seem to work – is this possible using another syntax?  Edit: The value isn't inherited from the parent element – the original values comes from an element-level selector. Sorry for any confusion!