Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Simple bug fix for radio buttons using the form validator #844

Open
wants to merge 17 commits into from

6 participants

@KZeni

Every radio button in a form was being required since a selector was set to ":radio". A simple fix is to change that to ":radio[required]". Sure a workaround is to use a "None" (or similar) input that's selected by default, but might as well have it only make the inputs required if specified.

0liver and others added some commits
@0liver 0liver added possibility to enclose tooltip element inside trigger element (…
…e.g. for table cells), incl. test
bb293ca
@brewt brewt Fix for clicking on the next/prev month when it's been disabled via v…
…isibility: hidden closes the calendar - target is the root node instead of the button.
28b63c5
@brewt brewt Fix for clicking on the next/prev month button hides calendar.
If the next/prev month buttons are hidden via visibility: hidden and the user clicks on the area where the button is after it's been hidden, the click event's target ends up being the root node. The code that checks for this expects the event to be a child of the root node instead of the root node itself, so this patch just adds a check for this.
ebb5784
@ewheeler ewheeler check each tooltip for existence, fixes issue 349
rather than checking if any tooltips already exist.
this way tooltips on some elements that are reloaded via
ajax calls will continue working. the previous code would
assume all tooltips still exist if *any* of the tooltips still
exist -- even if some of them no longer exist. now, part of a
page may be changed and can have new tooltips created instead
of only the ones for elements that did not change.

resolves: jquerytools#349

Signed-off-by: Adam Mckaig <adam.mckaig@gmail.com>
d55f9bb
@brewt brewt Merge branch 'master' of github.com:jquerytools/jquerytools 662fe03
@brewt brewt Merge branch 'dev' of github.com:brewt/jquerytools into dev 66376c9
@brewt brewt Merge branch 'dev' of github.com:jquerytools/jquerytools into dev
Conflicts:
	README.md
d37be46
@duclet duclet #480: Fixing readonly bug 6899ce4
@lagrz lagrz When you have a mask currently open and close and need another opened…
… right after. Enables chaining using the onClose callback method
aa46f7b
@duclet duclet Issue #563: Fixed a864dd0
@duclet duclet Merge pull request #670 from duclet/480
Fix for issue #480
702f227
@duclet duclet Merge pull request #706 from duclet/563
Fix for issue #563
144c7c1
@duclet duclet Merge pull request #496 from ewheeler/dev
fix unexpected behavior when calling $('my_selector').tooltip() a second time on altered elements
5127118
@duclet duclet Merge pull request #497 from brewt/dev
Fix for clicking on the next/prev month button hides calendar
0fcad6f
@duclet duclet Merge pull request #493 from 0liver/master
Added support for enclosing tooltip inside trigger element (2nd try)
b566aad
@duclet duclet Merge pull request #676 from lagrz/patch-3
Patch 3
b1b3b1c
@KZeni KZeni Make it so not every radio input is required
I think this was a possible oversight where ":radio" was the selector for checking validity to make sure a selection was made, but it really should be ":radio[required]" since it really should allow for optional radio inputs/groups. Simple change to 1 selector did the job.
cb955a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 9, 2010
  1. @0liver

    added possibility to enclose tooltip element inside trigger element (…

    0liver authored
    …e.g. for table cells), incl. test
Commits on Mar 14, 2011
  1. @brewt

    Fix for clicking on the next/prev month when it's been disabled via v…

    brewt authored
    …isibility: hidden closes the calendar - target is the root node instead of the button.
Commits on Sep 8, 2011
  1. @brewt

    Fix for clicking on the next/prev month button hides calendar.

    brewt authored
    If the next/prev month buttons are hidden via visibility: hidden and the user clicks on the area where the button is after it's been hidden, the click event's target ends up being the root node. The code that checks for this expects the event to be a child of the root node instead of the root node itself, so this patch just adds a check for this.
  2. @ewheeler

    check each tooltip for existence, fixes issue 349

    ewheeler authored
    rather than checking if any tooltips already exist.
    this way tooltips on some elements that are reloaded via
    ajax calls will continue working. the previous code would
    assume all tooltips still exist if *any* of the tooltips still
    exist -- even if some of them no longer exist. now, part of a
    page may be changed and can have new tooltips created instead
    of only the ones for elements that did not change.
    
    resolves: jquerytools#349
    
    Signed-off-by: Adam Mckaig <adam.mckaig@gmail.com>
  3. @brewt
  4. @brewt
  5. @brewt
Commits on Dec 18, 2011
  1. @duclet

    #480: Fixing readonly bug

    duclet authored
Commits on Feb 25, 2012
  1. @lagrz

    When you have a mask currently open and close and need another opened…

    lagrz authored
    … right after. Enables chaining using the onClose callback method
Commits on Mar 17, 2012
  1. @duclet

    Issue #563: Fixed

    duclet authored
Commits on Mar 21, 2012
  1. @duclet

    Merge pull request #670 from duclet/480

    duclet authored
    Fix for issue #480
  2. @duclet

    Merge pull request #706 from duclet/563

    duclet authored
    Fix for issue #563
  3. @duclet

    Merge pull request #496 from ewheeler/dev

    duclet authored
    fix unexpected behavior when calling $('my_selector').tooltip() a second time on altered elements
  4. @duclet

    Merge pull request #497 from brewt/dev

    duclet authored
    Fix for clicking on the next/prev month button hides calendar
Commits on Mar 25, 2012
  1. @duclet

    Merge pull request #493 from 0liver/master

    duclet authored
    Added support for enclosing tooltip inside trigger element (2nd try)
  2. @duclet

    Merge pull request #676 from lagrz/patch-3

    duclet authored
    Patch 3
Commits on Aug 20, 2012
  1. @KZeni

    Make it so not every radio input is required

    KZeni authored
    I think this was a possible oversight where ":radio" was the selector for checking validity to make sure a selection was made, but it really should be ":radio[required]" since it really should allow for optional radio inputs/groups. Simple change to 1 selector did the job.
This page is out of date. Refresh to see the latest.
View
11 src/dateinput/dateinput.js
@@ -289,7 +289,12 @@
//{{{ pick
- function select(date, conf, e) {
+ function select(date, conf, e) {
+ // If it is readonly, then we'll just close the calendar
+ if (input.attr('readonly')) {
+ self.hide(e);
+ return;
+ }
// current value
value = date;
@@ -402,7 +407,7 @@
$(document).on("click.d", function(e) {
var el = e.target;
- if (!$(el).parents("#" + css.root).length && el != input[0] && (!trigger || el != trigger[0])) {
+ if (!(el.id == css.root || $(el).parents("#" + css.root).length) && el != input[0] && (!trigger || el != trigger[0])) {
self.hide(e);
}
@@ -420,7 +425,7 @@
*/
show: function(e) {
- if (input.attr("readonly") || input.attr("disabled") || opened) { return; }
+ if (input.attr("disabled") || opened) { return; }
// onBeforeShow
e = e || $.Event();
View
4 src/toolbox/toolbox.expose.js
@@ -169,12 +169,12 @@
// onBeforeClose
if (call(config.onBeforeClose) === false) { return this; }
- mask.fadeOut(config.closeSpeed, function() {
- call(config.onClose);
+ mask.fadeOut(config.closeSpeed, function() {
if (exposed) {
exposed.css({zIndex: overlayIndex});
}
loaded = false;
+ call(config.onClose);
});
// unbind various event listeners
View
4 src/tooltip/tooltip.dynamic.js
@@ -67,8 +67,8 @@
var confOrigin = $.extend(true,{},conf),
cls = conf.classNames.split(/\s/),
- orig;
-
+ orig, ret;
+
this.each(function() {
var api = $(this).tooltip().onBeforeShow(function(e, pos) {
View
14 src/tooltip/tooltip.js
@@ -203,7 +203,8 @@
// manual tooltip
} else {
- tip = trigger.next();
+ tip = trigger.find('.' + conf.tipClass);
+ if (!tip.length) { tip = trigger.next(); }
if (!tip.length) { tip = trigger.parent().next(); }
}
@@ -331,10 +332,6 @@
// jQuery plugin implementation
$.fn.tooltip = function(conf) {
-
- // return existing instance
- var api = this.data("tooltip");
- if (api) { return api; }
conf = $.extend(true, {}, $.tools.tooltip.conf, conf);
@@ -344,9 +341,12 @@
}
// install tooltip for each entry in jQuery object
+ // that is not an existing instance
this.each(function() {
- api = new Tooltip($(this), conf);
- $(this).data("tooltip", api);
+ if ( $(this).data("tooltip")===null){
+ api = new Tooltip($(this), conf);
+ $(this).data("tooltip", api);
+ };
});
return conf.api ? api: this;
View
2  src/validator/validator.js
@@ -258,7 +258,7 @@
return v === '' || new RegExp("^" + el.attr("pattern") + "$").test(v);
});
- v.fn(":radio", "Please select an option.", function(el) {
+ v.fn(":radio[required]", "Please select an option.", function(el) {
var checked = false;
var els = $("[name='" + el.attr("name") + "']").each(function(i, el) {
if ($(el).is(":checked")) {
View
33 test/tooltip/index.html
@@ -107,6 +107,39 @@
</div>
+<div id="manual-enclosed" class="test">
+
+ <h3>Manual enclosed tooltip</h3>
+
+ <table>
+ <tbody>
+ <tr>
+ <td class="trigger">
+ trigger 1
+ <div class="tooltip">Manual enclosed #1</div>
+ </td>
+ <td class="trigger">
+ trigger 2
+ <div class="tooltip">Manual enclosed #2</div>
+ </td>
+ <td class="trigger">
+ trigger 3
+ <div class="tooltip">Manual enclosed #3</div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <script>
+ $("#manual-enclosed td").tooltip({
+ delay: 300,
+ predelay: 0,
+ effect: 'fade'
+ });
+ </script>
+
+</div>
+
<div id="same" class="test">
<h3>Same tip element</h3>
Something went wrong with that request. Please try again.