[jQuery] Re: Link Clicks Double Firing

2010-01-15 Thread Collectonian
This :-) Also, if I remove the a href, it would break the links
(dynamically generated by the web application on load) and the preview
panels :-) Adding the second return false;, as suggested by Matt has
fixed it quite nicely!  Thanks all :-(

On Jan 14, 8:55 am, Matt Maxwell  wrote:
> That is true, but if you remove the link's href, the application will not
> degrade for users without JavaScript enabled.
>
> On Thu, Jan 14, 2010 at 8:46 AM, bill  wrote:
> > this really an interesting jq/html semantic issue: if the  tag is
> > not handling the actual redirection to another page, maybe we
> > shouldn't be using the  tag at all. maybe the href should really
> > just be stored in the jq routine. this clears up maintenance issues
> > and passes the gut check.


[jQuery] Link Clicks Double Firing

2010-01-13 Thread Collectonian
I have a bit of code on one page to make an entire table cell a
clickable area to open a PDF in a new window. It works perfectly,
unless you click the actual physical link. If someone clicks the link,
it opens the link twice in two new windows. Inside the usual document
ready, I have:

$('#factsheets td').click(function() {
$(this).find('a').each(function(){
window.open(this.href);
return false;
});
});

And a snippet of code from the document:




SRAC
0230Alligator Production: An Introduction



How can I fix it so that clicking on the link is considered just a
single click instead of two, so that only one window opens?

~~ Summer


[jQuery] Re: (validate) validator is undefined error

2009-10-30 Thread Collectonian
Awesome! That worked! Thank you so much!

~~ Summer

On Oct 29, 4:38 pm, Jules  wrote:
> Sorry, didn't read the question thoroughly,
>
>                     whyvisitother: {
>                         required: function(element) {
>
>                             var result = false;
>                             var chk = $("[name=whyvisit]");
>
>                             $("[name=whyvisit]:checked").each(function
> () {
>                                 if (chk.index($(this)) == 4)
>                                     result = true;
>                             });
>
>                             return result;
>                         }
>                     }
>


[jQuery] Re: (validate) validator is undefined error

2009-10-29 Thread Collectonian
Thanks, but that only seems to work if they only pick other. Since
they can pick multiple checkboxes from that set, I need to see if they
picked it among possibly multiple others.

On Oct 28, 5:50 pm, Jules  wrote:
> Use this rule.
>                 whyvisitother: {
>                     required: function(element) {
>                     return $("[name=whyvisit]").index($
> ("[name=whyvisit]:checked")) == 4;
>                     }


[jQuery] Re: (validate) validator is undefined error

2009-10-28 Thread Collectonian
With the suggestion earlier, everything is working great, yay! All of
my validation rules are also working, as well, except I can't figure
out how to write the rule for my multi-option check box that has an
"Other" option so that if other is among those checked, it will
require the other input box be filled in. I have two similar ones like
that, but since they are radio buttons, I was able to just use rules
based on the demos. The rules I have and the relevant bit of the HTML
form below for easier reading. Basically, if one of the options
selected in the whyvisit set of checkboxes is the other option, the
whyvisitother input field needs to be required.

~~ SNIPPET ~~
rules: {
recommend: "required",
howlearnedother: {
required: function(element) {
return $('#howlearned input[name=howlearned]:checked').val() == 
0;
}
},
describeyouother: {
required: function(element) {
return $('#describeyou input[name=describeyou]:checked').val() 
== 0;
}
}
},

~~HTML ~~
Why did you visit the SRAC web site?

 Aquaculture producer looking for information 
Educator looking for information for my classroom


Middle School
High School
2-Year College
4-Year College


 Student


Middle School
High School
2-Year College
4-Year College


 Individual interested in learning more about
aquaculture
 Other  



[jQuery] Re: (validate) validator is undefined error

2009-10-28 Thread Collectonian

Thanks...I go beat my own head now...can't believe I missed that!

On Oct 27, 9:08 pm, Jules  wrote:
> Change
>
> var validator = $("#surveyForm").validate({
>
> to
>
> var validator = $("form").validate({
>
> or
>
> 
>                         
> to
>
> 
>                         
>
> Good luck.


[jQuery] (validate) validator is undefined error

2009-10-27 Thread Collectonian

I'm trying to implement Validate on a survey form that has just a few
basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5.
Whenever I try to run the code, however, I get an error that
"validator is undefined". I tried Googling and found only a few hits,
most saying the HTML was invalid. Checked that, corrected a few minor
errors, but still getting the error. In addition to the code below, I
tried just the basic $("#surveyForm").validate()  but it still gives
the same error. This is on a development application, so it isn't
available online yet.

Summer

SNIPPET FROM JS FILE
var validator = $("#surveyForm").validate({
rules: {
recommend: "required",
howlearnedother: {
required: function(element) {
return $('#howlearned 
input[name=howlearned]:checked').val() == 0;
}
},
describeyouother: {
required: function(element) {
return $('#describeyouother input
[name=describeyouother]:checked').val() == 0;
}
}
},
messages: {
recommend: "Please indicate if you would recommend the SRAC 
site to
others",
howlearnedother: "Please indicate how you learned about SRAC's
publications.",
describeyouother: "Please indicate your industry."
}
});

~~~SNIPPET OF HTML FORM



Please complete this survey to help us 
improve our
offerings:
What is the likelihood 
that you would
recommend the SRAC web site or its publications to your family and
friends? Choose one number below with 1 = not likely and 10 = highly
likely.


 1
 2
 3
 4
 5
 6
 7
 8
 9
 10



How did you learn about 
SRAC publications?



 Linked from another web site

 Search engine

 Professional (e.g. Fisheries/aquaculture biologists)


 Extension program

 Friend

 Magazine

 Book

 Other 




Why did you visit the 
SRAC web site?


 Aquaculture producer looking for information

 Educator looking for information for my classroom







Middle School


High School


2-Year College


4-Year College





 Student






Middle School


High School


2-Year College



4-Year College




 Individual interested in learning more about
aquaculture

 Other 




Which of the following 
is b

[jQuery] Re: jQuery UI Tabs - Select Tab?

2009-10-16 Thread Collectonian

Found it! It needs to be:

$('#tabs').tabs().tabs('select', 1); // => 0 with the extra tabs(). :-
D Got it working now! Thanks,

Summer S. Wilson
Collectonian on Yahoo! Messenger ~ Facebook (http://www.facebook.com/
Collectonian)
An Eclectic World  (http://eclectic-world.com) ~ LiveJournal (http://
collectonian.livejournal.com)

On Oct 16, 2:13 pm, Collectonian 
wrote:
> We tried that as well, and still no go.
>
> On Oct 15, 1:01 pm, MorningZ  wrote:
>
> > $("#tabs").tabs("select", idx);
>


[jQuery] Re: jQuery UI Tabs - Select Tab?

2009-10-16 Thread Collectonian

We tried that as well, and still no go.

On Oct 15, 1:01 pm, MorningZ  wrote:
> $("#tabs").tabs("select", idx);
>
> where "idx" is the numeric index of the tab to select
>
> On Oct 15, 11:53 am, Collectonian 
> wrote:
>
>
>
> > We are using the jQuery UI's tabs functions to do a tab on a web
> > application. The tabs are loading fine and work perfectly when
> > clicking them. In some instances, though, we want to default the page
> > to have a specific tab selected on load. How do we do this? We tried
> > looking through the docs, but nothing we tried worked. In our main JS
> > file, we load the tabs with:
>
> > $(document).ready(function(){
> >         $("#tabs").tabs();
>
> > });
>
> > Then in the page itself, when we want it to switch to a specific tab,
> > we have:
>
> > 
> >         $('#tabs').tabs({ 'option', 'selected', 1 });
> > 
>
> > We also tried:
>
> > $('.selector').tabs('option', 'selected', 1);
>
> > and
>
> > var $tabs = $('#tabs').tabs({
> >     add: function(event, ui) {
> >         $tabs.tabs('select', '#securityTab');
> >     }
>
> > });
>
> > Summer S. Wilson
> > Collectonian on Yahoo! Messenger
> > An Eclectic World  (http://eclectic-world.com)
> > LiveJournal (http://collectonian.livejournal.com)- Hide quoted text -
>
> - Show quoted text -


[jQuery] jQuery UI Tabs - Select Tab?

2009-10-15 Thread Collectonian

We are using the jQuery UI's tabs functions to do a tab on a web
application. The tabs are loading fine and work perfectly when
clicking them. In some instances, though, we want to default the page
to have a specific tab selected on load. How do we do this? We tried
looking through the docs, but nothing we tried worked. In our main JS
file, we load the tabs with:

$(document).ready(function(){
$("#tabs").tabs();
});

Then in the page itself, when we want it to switch to a specific tab,
we have:


$('#tabs').tabs({ 'option', 'selected', 1 });


We also tried:

$('.selector').tabs('option', 'selected', 1);

and

var $tabs = $('#tabs').tabs({
add: function(event, ui) {
    $tabs.tabs('select', '#securityTab');
}
});

Summer S. Wilson
Collectonian on Yahoo! Messenger
An Eclectic World  (http://eclectic-world.com)
LiveJournal (http://collectonian.livejournal.com)