[jQuery] Re: validate

2009-07-27 Thread Jörn Zaefferer

Take a look at the available options:
http://docs.jquery.com/Plugins/Validation/validate#options

The one you should start with is showErrors. The default displays the
inline messages, and by overriding it, you should be able to join the
error messages into a string and put that into an altert.

Jörn

On Mon, Jul 27, 2009 at 6:46 AM, Bibinbibin.balakrish...@gmail.com wrote:

 Hi,
  I am new to jquery and wanted to use jauery validate plugin in my
 project. But I have seen that jquery displays errors as inline
 messages.But in order to remain backward compatibility in my project,
 I have to show the error messages as an alert, ie all error messages
 aggregated into a single message.Is there any way by which I can
 customise this in the plugin.I think I can get a hanlde of all the
 error messages,and publish it as an alert, rather modifying the dom to
 show as inline messages.Any pointer into this will be helpful. Thanks
 in advance



[jQuery] Re: Content Loads then Javascript

2009-07-27 Thread Mushex Antaranian

Hi
Content must be loaded before you can do any manipulations with it via
js..
Or you can load content via ajax calls ( i.e. $.load() ) and modify it
before appending to document.. But it isn't the most nice way to do
it..

Can you explain what exactly you are trying to do ??

Btw i think you are loading 3 copies of jquery file, but maybe I'm
wrong..

On Jul 27, 5:59 am, Mutual Designs mike.f.griffi...@gmail.com wrote:
 How do I prevent the content loading on my website before the
 Javascript loads. It seems that all of my Javascript is loading in the
 head of my page, but the content all shows before being modified by
 the javascript.

 http://boomer-living.com/wp/

 Any suggestions?


[jQuery] Re: Content Loads then Javascript

2009-07-27 Thread Mushex Antaranian

$(document).ready(function() {  /* your code */ })  -this means that
code inside {} brackets will execute after DOM is loaded..


On Jul 27, 5:59 am, Mutual Designs mike.f.griffi...@gmail.com wrote:
 How do I prevent the content loading on my website before the
 Javascript loads. It seems that all of my Javascript is loading in the
 head of my page, but the content all shows before being modified by
 the javascript.

 http://boomer-living.com/wp/

 Any suggestions?


[jQuery] Re: jQuery Form Validation

2009-07-27 Thread Tuppers360

Thanks for that! I thought of doing something like that but it means
validating twice really so I was thinking that when the validation
call is done and the field, whatever it may be is correct then it
removes the span.

Problem is I dont get where the plugin adds the checked class I know
that it does add a checked class as I have a css file to add an image
when there is 'label.checked' I have tried find the labels with this
class to then find the span class from and then hide the span there
but I cant seem to find it!

I hope you understand that?

On Jul 26, 11:10 pm, FrenchiINLA mamali.sohe...@gmail.com wrote:
 how about

             $('input[type=text]').keyup(function() {

                 if ($(this).val().length == 2) {
                     $(this).prev().find('span').empty();
                 }
             });

 On Jul 26, 10:36 am, Tuppers360 tuppers...@sky.com wrote:



  Hi there just wondering if I can get some help from you guys?

  I have some code as per:

  // validate signup form on keyup and submit
              var validator = $('form').validate({
                  event: 'keyup',
                  rules: {
                      '%= ddlRank.UniqueID %': {
                          required: true
                      },
                      '%= txtSurname.UniqueID %': {
                          minlength: 2,
                          required: true
                      },
                      '%= txtForename.UniqueID %': {
                          minlength: 2,
                          required: true
                      },
                      '%= ddlGender.UniqueID %': {
                          required: true
                      },
                      '%= txtBirthDate.UniqueID %': {
                          required: true,
                          custEmailVal: true
                      }

                  }, //end rules
                  messages: {
                      '%= txtSurname.UniqueID %': {
                          minlength: jQuery.format(Enter at least {0}
  characters),
                          required: This field is required
                      },
                      '%= txtForename.UniqueID %': {
                          minlength: jQuery.format(Enter at least {0}
  characters),
                          required: This field is required
                      },
                      '%= ddlGender.UniqueID %': {
                          required: This field is required
                      },
                      '%= txtBirthDate.UniqueID %': {
                          required: This field is required
                      }
                  }, //end messages
                  // specifying a submitHandler prevents the default
  submit, good for the demo
                  submitHandler: function() {
                      alert(submitted!);
                  }, //end submitHandler
                  // set this class to error-labels to indicate valid
  fields
                  success: function(label) {
                      // set nbsp; as text for IE
                      label.html(nbsp;).addClass(checked);
                      $('label.checked').addClass('alt');
                      //$('form :input')
                      //        .filter('.required').prev
  ('label.checked').find('span').hide();
                  }, //end success function(label)
                  invalidHandler: function(form, validator) {
                      var errors = validator.numberOfInvalids();
                      if (errors) {
                          var message = errors == 1
                          ? 'You missed 1 field. It has been
  highlighted'
                          : 'You missed ' + errors + ' fields. They have
  been highlighted';
                          $('div/div')
                              .attr({
                                  'id': 'submitError',
                                  'class': 'warning'
                              })
                              .insertBefore('#newuserForm');
                          $(div#submitError).html(message);
                          $(div#submitError).show();
                          $('form :input')
                              .filter('.required').prev('label').find
  ('span').hide();
                      } else {
                          $(div#submitError).hide();
                      }
                  } //end invalidHandler
              }); //end validate all

  my html is an ordered list and the within each li tag I have this
  structure:

  label for=txtSurname id=lblSurname
                          Surname:span(required)/span
                      /label
                      input name=txtSurname type=text
  id=txtSurname class=inputText required /

  What I want to happen is when I have input two characters into the
  field so that it validates is to hide the span containing the word
  required. I cant seem to find it though! I am not sure if am am right
  though 

[jQuery] Re: Unable to get the latest text/value inside a textarea

2009-07-27 Thread north

Hi, I didn't check your code, but when you write current value and
old value I supposed you change those dynamically. In that you
should take a look at this:

http://docs.jquery.com/Events/live

Cheers

On 27 Jul., 05:49, JC joel.cook...@gmail.com wrote:
 Now, I was not expecting this. You can get the text inside the
 textarea using something like:

 alert($('#id_of_textarea').text());

 That works, but if you bind it with an event, let’s say onkeyup — you
 will never get the “latest” text inside the textarea. This was a
 complete surprise to me. The best way to do it would be to use the attr
 (’value’)

 In the example below CustomerNotes is a textarea and it doesn't matter
 how I try to get the current value I end up getting the old value.  I
 have tried using $(#..).val() and $(#..).text.

 Any suggestions or advice would be greatly appreciated

 Thanks,
 Joel

 code
 $(#save_forecast).die(click);
         $(#save_forecast).live(click, function() {
             $.ajax({
                 type: 'POST',
                 url: '/core/forecasts/SaveComputeForecast',
                 data: { request.Id: %=Model.Id %,
                     request.StartDate: $(#StartDate).val(),
                     request.EndDate: $(#EndDate).val(),
                     request.ResourceAmountRequested: $
 (#ResourceAmountRequested).val(),
                     request.OS: $(#OS).val(),
                     request.MemorySizeInGb: $(#MemorySizeInGb).val
 (),
                     request.CustomerNotes: $(#CustomerNotes).text
 ()
                 },
                 beforeSend: function() {
                 },
                 success: function(data, textStatus) {
                     $(#forcast_content).fadeOut('slow', function() {
                         $(#forcast_content).html(centerForecast
 saved/center);
                         $(#forcast_content).fadeIn('slow');
                         $.PopulateCurrentComputeForecastTable();
                     });
                 },
                 complete: function() {
                 }
             });
 /code


[jQuery] Html images not displayed within a jQuery load - Help needed!

2009-07-27 Thread eelziere

Hi All,

I have the following page:

http://87.90.101.154/DesignAndCo/index.php?Itemid=38option=com_virtuemartlang=frpage=shop.product_detailsflypage=product_flypage_design_and_coproduct_id=372category_id=40manufacturer_id=24

If you move the mouse cursor over the orange Euro image, a jQuery
popup is opened but the images loaded are not displayed.

If you invoke alone the page loading the images, they are properly
displayed:

http://87.90.101.154/DesignAndCo/index2.php?option=com_virtuemartpage=shop.product_payment_methodsproduct_id=372no_html=1

Could anybody explain me why the images are not displayed within
jQuery?

Thanks in advance.

Cheers,
EE.


[jQuery] Re: Html images not displayed within a jQuery load - Help needed!

2009-07-27 Thread Sander Thalen
The first time I held the mouse over the image, the images did not display.
But when I held the mouse over it again, the images showed. I saw them
fading in as well, so it seems they first need to be loaded after the
element is called.

Hope this helps a little bit to diagnose the problem.

On Mon, Jul 27, 2009 at 12:59 PM, eelziere eelzi...@hotmail.com wrote:


 Hi All,

 I have the following page:


 http://87.90.101.154/DesignAndCo/index.php?Itemid=38option=com_virtuemartlang=frpage=shop.product_detailsflypage=product_flypage_design_and_coproduct_id=372category_id=40manufacturer_id=24

 If you move the mouse cursor over the orange Euro image, a jQuery
 popup is opened but the images loaded are not displayed.

 If you invoke alone the page loading the images, they are properly
 displayed:


 http://87.90.101.154/DesignAndCo/index2.php?option=com_virtuemartpage=shop.product_payment_methodsproduct_id=372no_html=1

 Could anybody explain me why the images are not displayed within
 jQuery?

 Thanks in advance.

 Cheers,
 EE.


[jQuery] page-sliding jQuery Javascript code not playing with DHTML page

2009-07-27 Thread utimass


Using the following code example from Scott Robbin, which simply allows for
separate html pages to slide in and out of the one screen, I wanted to
expand this by sliding in some DHTML. 

Here is the page-sliding code used:
http://srobbin.com/blog/jquery-pageslide/

DHTML animated code:
http://www.dhteumeuleu.com/colorsyntax/viewJS.php?src=yoshisland.htmlsound=smw21-1.mid
 
(http://www.dhteumeuleu.com/dhtml/yoshisland.html) 

...but, at best, only the images show, placed still and next to each other.
As you will see the DHTML is a rotating set of imagery. Something in the
page-sliding code seems to be preventing that DHTML animation from
displaying as it should. Like I said the images will be recognised, but they
don't display - I've even tried hard linking to the images. 

Here's my page: http://www.cachet.projectmio.com/ 

Here's the page which I have on my server, the one I would like to have
slide in: 

http://www.cachet.projectmio.com/code/whirl.html 

To see the sliding animation click the bottom What cachet does option that
slides the right hand pane in. 


Thanks to anybody!
-- 
View this message in context: 
http://www.nabble.com/page-sliding-jQuery-Javascript-code-not-playing-with-DHTML-page-tp24679601s27240p24679601.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
jQuery (English) group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to 
jquery-en+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~--~~~~--~~--~--~---



[jQuery] Re: Content Loads then Javascript

2009-07-27 Thread Insen

Maybe you can hide the elemets first(using css), then after the
javascript loaded, modify elements and show them.
This still isn't a nice way.

On Jul 27, 8:59 am, Mutual Designs mike.f.griffi...@gmail.com wrote:
 How do I prevent the content loading on my website before the
 Javascript loads. It seems that all of my Javascript is loading in the
 head of my page, but the content all shows before being modified by
 the javascript.

 http://boomer-living.com/wp/

 Any suggestions?


[jQuery] Re: switching jquery tabs in code behind(C#)

2009-07-27 Thread noorul

My aspx page:

script type=text/javascript
$(function() {

$('#date0').datepicker({
changeMonth: true,
changeYear: true,
yearRange: '-30:+0'


});

 /script



div id=tabs
ul
lia href=#tabs-1All/a/li
lia href=#tabs-2Awaiting
Instructions/a/li
lia href=#tabs-3Waiting For
Upload/a/li
lia href=#tabs-4In Progress/
a/li
lia href=#tabs-5Seeking
Clarifications/a/li
lia href=#tabs-6Awaiting
Feedback/a/li
lia href=#tabs-7Completed/
a/li
/ul

  div id=tabs-1
asp:Button ID=btnInstruction1 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
  div id=tabs-2
asp:Button ID=btnInstruction2 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
  div id=tabs-3
asp:Button ID=btnInstruction3 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
  div id=tabs-4
asp:Button ID=btnInstruction4 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
  div id=tabs-5
asp:Button ID=btnInstruction5 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
  div id=tabs-6
asp:Button ID=btnInstruction6 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
  div id=tabs-7
asp:Button ID=btnInstruction7 runat=server
Text=Instructions on the Selected Jobs /
 ...Grid with some datas...
 /div
/div


After clicking of a button in any tabs it stay on the same tabFor
example i'm clicking the button btnInstruction7. which is inside the
tab-7. The tab-7 should be selected after the button click event



My .aspx.cs page:

protected void btnSearch7_Click(object sender, EventArgs e)
{

 Some code here


string _tabSelected = $(\#tabs\).tabs('option',
'selected', 6);;

Page.ClientScript.RegisterClientScriptBlock(this.GetType
(), startupTabScript, _tabSelected, true);

 }



Its not working..The first tab get selected after that postback..Can
anyone tell me the solution for this...











On Jul 24, 12:02 pm, noorul noorulameen...@gmail.com wrote:
 Hi karngu, Here is the one of my tab: Can you send me the javascript
 to select this tab..

  div id=tabs
                                 ul
                                     lia href=#tabs-1 style=font-
 size: 12pxAll/a/li
                                 /ul
                                div id=tabs-1
                                /div
 /div

 On Jul 24, 1:38 am, karnqu jake.al...@gmail.com wrote:



  like morningZ said your probably looking for this...
  ClientScript.RegisterStartupScript(typeof (page class name),
  startupTabScript, javascript to select correct tab, true);

  The pain is knowing what the last tab they selected was. But in your
  case if the button they clicked was on that tab then it sounds pretty
  straight forward.

  On Jul 23, 1:34 pm, MorningZ morni...@gmail.com wrote:

   onclick event would be:

   - in the aspx'scode?
   - on the client?

   if it is in thecode, then any running of that postbackcodeis going
   to cause a page reload, and consequent defaulting to the first tab by
   default

   if you want the new page reload to stay on the current tab, then you
   would emit some client script (using Page.ClientScript) object to call
   theTabs' event that will switch the tab

   On Jul 23, 9:49 am, noorul noorulameen...@gmail.com wrote:

I have five div tags(jquerytabs) in my aspx page...Inside the second
div(tab) i have a button. onclick of that buttton the second div(tab)
should be switched..instead of that the first tab is coming.. How can
i switch the tab incodebehind(Inside button onclick event)...


[jQuery] Problem with sorting after dragging.

2009-07-27 Thread freq

Hi,

I'm using Jquery to both Drag (and drop) and sort a visual list or
representation of VOIP phones.

The problem is that after I have dragged (and dropped) a DIV. It will
not sort at all anymore.

After you have dropped for sorting, the DIV goes back to where I
dropped it with dragging.

I have tried several thing including disabling sorting just when
starting to drag and enabling it back  when dragging is stopped.

This does not seem to help at all.

Anyone can help me with this? I would appreciate it at alot.

Thanks.


[jQuery] Registration Point

2009-07-27 Thread sean

Hi Everyone,

I am trying to get images to animate from the center in height and
width.

I can get the animation to work but can't find anywhere how to get it
to work from the central point!

Hopefully someone can help me here.

Thanks

Sean


[jQuery] Re: Content Loads then Javascript

2009-07-27 Thread amuhlou

I think this article may help:
http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content



On Jul 27, 3:51 am, Mushex Antaranian jesirobende...@gmail.com
wrote:
 $(document).ready(function() {  /* your code */ })  -this means that
 code inside {} brackets will execute after DOM is loaded..

 On Jul 27, 5:59 am, Mutual Designs mike.f.griffi...@gmail.com wrote:

  How do I prevent the content loading on my website before the
  Javascript loads. It seems that all of my Javascript is loading in the
  head of my page, but the content all shows before being modified by
  the javascript.

 http://boomer-living.com/wp/

  Any suggestions?


[jQuery] Re: tablesorter, sort values in anchor as numerics

2009-07-27 Thread mila

I am sorry, I did not understand your answer.  Do you have a solution
to my problem?

On Jul 26, 3:41 am, 刘永杰 liuyongjie...@gmail.com wrote:
 easyer.

 2009/7/25 mila mshneyder...@gmail.com



  I have data that looks like that

  a href='myURL/myapp?name=mynameparam1=val'23/a
  a href='myURL/myapp?name=hisnameparam1=val1'9/a

  I need it to be sorted numericaly by values between /a.  How do I
  do that?




[jQuery] [treeview] Basic documentation - but where?

2009-07-27 Thread SuneR

Hi,

I have today started to mess around with the Treeview plugin, but I
have not been able to find a decent documentation. Am I just looking
in the wrong places?

I would have thought that by going here - 
http://docs.jquery.com/Plugins/Treeview/treeview#options
I would see all the available options, and a description of them.

I have looked in the demo.js file from the download, and can see that
an option called control exsists. But I have no idea how to use it -
from the examples I can see it can make the entire tree collapse, and
the entire tree expand. But how do I tell it what links it should add
the event on? When I initialize the treeview like in the demo, the
links I have does nothing what-so-ever.

Can someone explain how I use the controls?

or even better, point me to some documentation that explains all the
options?

/Sune


[jQuery] Re: [treeview] Basic documentation - but where?

2009-07-27 Thread Jörn Zaefferer

That page as an options tab:
http://docs.jquery.com/Plugins/Treeview/treeview#toptions

Jörn

On Mon, Jul 27, 2009 at 3:21 PM, SuneRsyko...@gmail.com wrote:

 Hi,

 I have today started to mess around with the Treeview plugin, but I
 have not been able to find a decent documentation. Am I just looking
 in the wrong places?

 I would have thought that by going here - 
 http://docs.jquery.com/Plugins/Treeview/treeview#options
 I would see all the available options, and a description of them.

 I have looked in the demo.js file from the download, and can see that
 an option called control exsists. But I have no idea how to use it -
 from the examples I can see it can make the entire tree collapse, and
 the entire tree expand. But how do I tell it what links it should add
 the event on? When I initialize the treeview like in the demo, the
 links I have does nothing what-so-ever.

 Can someone explain how I use the controls?

 or even better, point me to some documentation that explains all the
 options?

 /Sune


[jQuery] Re: $(document).ready script appears to not run in IE?

2009-07-27 Thread amuhlou

glad it worked!

On Jul 27, 12:15 am, Billy mail.billy...@gmail.com wrote:
 Thank you for that hint - I changed the CSS to display:inline, and the
 script now works fine on IE. :D

 On Jul 21, 1:13 am, amuhlou amysch...@gmail.com wrote:

  I don't know if this is part of the issue or not, but IE7 does not
  have support for the display:table; property.

  See quirksmode to see what properties it does support (not 
  many):http://www.quirksmode.org/css/display.html

  On Jul 20, 2:44 am, Billy mail.billy...@gmail.com wrote:

   Hello all,

   I'm relatively new to jQuery, and I'm having some trouble making a
   selected tbody display in IE. It seems to work fine in FireFox, and
   Chrome.

   See here:

  http://wwwdev.latrobe.edu.au/nursing/ProspectiveStudents/Postgraduate...

   I've looked up various fora, but the only things I can find seem to
   relate to earlier versions of jQuery. We're running jQuery-min.1.3.2
   on this site.

   The relevant parts of the code which run in FF/Chrome, but appear to
   not run in IE:

   script language=javascript type=text/javascript
   $(document).ready(function()
   {
       //...
           $('#questionTable tbody:first').addClass('selected');

      //...

   });

   /script

   Relevant CSS associated with this:

   style
   #questionTable tbody {
           display: none;}

   #questionTable tbody.selected {
           display:table;}

   /style

   Help?

   Thanks in advance,

   Billy


[jQuery] Re: Problem with sorting after dragging.

2009-07-27 Thread Dhruva Sagar
Hi,

Have you tried using the connectToSortable option for draggable?


Thanks  Regards,
Dhruva Sagar.


On Mon, 2009-07-27 at 00:21 -0700, freq wrote:

 Hi,
 
 I'm using Jquery to both Drag (and drop) and sort a visual list or
 representation of VOIP phones.
 
 The problem is that after I have dragged (and dropped) a DIV. It will
 not sort at all anymore.
 
 After you have dropped for sorting, the DIV goes back to where I
 dropped it with dragging.
 
 I have tried several thing including disabling sorting just when
 starting to drag and enabling it back  when dragging is stopped.
 
 This does not seem to help at all.
 
 Anyone can help me with this? I would appreciate it at alot.
 
 Thanks.
attachment: draft-paper.png

[jQuery] Re: page-sliding jQuery Javascript code not playing with DHTML page

2009-07-27 Thread utimass


correction, I got the images showing now, but not the animation.
-- 
View this message in context: 
http://www.nabble.com/page-sliding-jQuery-Javascript-code-not-playing-with-DHTML-page-tp24679601s27240p24682206.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Ajax parsererror

2009-07-27 Thread TCoakley

I was able to get this to work perfectly by removing the dataType. It
ran my success function and parsed as XML. Is this a bug?

On Jul 24, 3:01 pm, TCoakley ebun...@gmail.com wrote:
 I am attempting a fairly easy ajax call within a zend framework, but
 am getting a parseerorr. I have validated the xml and will show that
 below. No js errors are being thrown.

 The ajax call:
     $(function() {
         $('#AjaxListAnchor').click(function() {
             $.ajax({
                 type: GET,
                 url: /xml/index/messages,
                 dataType: xml,
                 error: function(XMLHttpRequest, textStatus,
 errorThrown){
                     alert('Error loading XML document\n' +
 textStatus);
                 },

                 success: function(xml) {
                     $(xml).find('message').each(function(){
                         var message = $(this).text();
                         $('li/li')
                             .html(message)
                             .appendTo('#AjaxList');
                     });
                 }
             });
         });
     });

 The xml from /xml/index/messages
 ?xml version=1.0 encoding=utf-8?
 messages
         messageComputer science is no more about computers than astronomy
 is about telescopes. /message
         messagePeople think computers will keep them from making mistakes.
 They're wrong. With computers you make mistakes faster. /message
         messageNever trust a computer you can't throw out a window. /
 message
         messageTo err is human - and to blame it on a computer is even more
 so./message
         messageA computer once beat me at chess, but it was no match for me
 at kick boxing. /message

         messageComputing is not about computers any more. It is about
 living. /message
         messageTreat your password like your toothbrush. Don't let anybody
 else use it, and get a new one every six months. /message
 /messages


[jQuery] Re: jQuery Form Validation

2009-07-27 Thread Tuppers360

Well I have sorted the problem of the span when there is a sucess on
the input. I have added these two lines to the success method:

label.prev('form :input').addClass('valid');
$('form :input').filter('.valid').prev('label').find('span').hide();

My problem is now that when there is an on the input I cant seem to
sort it out when there is an error on keyup? Should I use
errorPlacement? I cant seem to find much documentaion on it though?

Cheers

Tuppers

On Jul 27, 9:01 am, Tuppers360 tuppers...@sky.com wrote:
 Thanks for that! I thought of doing something like that but it means
 validating twice really so I was thinking that when the validation
 call is done and the field, whatever it may be is correct then it
 removes the span.

 Problem is I dont get where the plugin adds the checked class I know
 that it does add a checked class as I have a css file to add an image
 when there is 'label.checked' I have tried find the labels with this
 class to then find the span class from and then hide the span there
 but I cant seem to find it!

 I hope you understand that?

 On Jul 26, 11:10 pm, FrenchiINLA mamali.sohe...@gmail.com wrote:



  how about

              $('input[type=text]').keyup(function() {

                  if ($(this).val().length == 2) {
                      $(this).prev().find('span').empty();
                  }
              });

  On Jul 26, 10:36 am, Tuppers360 tuppers...@sky.com wrote:

   Hi there just wondering if I can get some help from you guys?

   I have some code as per:

   // validate signup form on keyup and submit
               var validator = $('form').validate({
                   event: 'keyup',
                   rules: {
                       '%= ddlRank.UniqueID %': {
                           required: true
                       },
                       '%= txtSurname.UniqueID %': {
                           minlength: 2,
                           required: true
                       },
                       '%= txtForename.UniqueID %': {
                           minlength: 2,
                           required: true
                       },
                       '%= ddlGender.UniqueID %': {
                           required: true
                       },
                       '%= txtBirthDate.UniqueID %': {
                           required: true,
                           custEmailVal: true
                       }

                   }, //end rules
                   messages: {
                       '%= txtSurname.UniqueID %': {
                           minlength: jQuery.format(Enter at least {0}
   characters),
                           required: This field is required
                       },
                       '%= txtForename.UniqueID %': {
                           minlength: jQuery.format(Enter at least {0}
   characters),
                           required: This field is required
                       },
                       '%= ddlGender.UniqueID %': {
                           required: This field is required
                       },
                       '%= txtBirthDate.UniqueID %': {
                           required: This field is required
                       }
                   }, //end messages
                   // specifying a submitHandler prevents the default
   submit, good for the demo
                   submitHandler: function() {
                       alert(submitted!);
                   }, //end submitHandler
                   // set this class to error-labels to indicate valid
   fields
                   success: function(label) {
                       // set nbsp; as text for IE
                       label.html(nbsp;).addClass(checked);
                       $('label.checked').addClass('alt');
                       //$('form :input')
                       //        .filter('.required').prev
   ('label.checked').find('span').hide();
                   }, //end success function(label)
                   invalidHandler: function(form, validator) {
                       var errors = validator.numberOfInvalids();
                       if (errors) {
                           var message = errors == 1
                           ? 'You missed 1 field. It has been
   highlighted'
                           : 'You missed ' + errors + ' fields. They have
   been highlighted';
                           $('div/div')
                               .attr({
                                   'id': 'submitError',
                                   'class': 'warning'
                               })
                               .insertBefore('#newuserForm');
                           $(div#submitError).html(message);
                           $(div#submitError).show();
                           $('form :input')
                               .filter('.required').prev('label').find
   ('span').hide();
                       } else {
                           $(div#submitError).hide();
         

[jQuery] International numeric formatting on the fly with multiple rounding options

2009-07-27 Thread Bob

To all:

I have created a plugin that handles International numeric formatting
on the fly by using a Reg Expression. Before I release this I would
appreciate comments and suggestions for improvements.

Demo can be viewed here http://decorplanit.com/plugin/index.htm

Thanks in advance.

Bob


[jQuery] Re: Combining jQuery Objects

2009-07-27 Thread Neilski

Thanks Ricardo, that was exactly what I was looking for - just in the
wrong place I guess!

On Jul 23, 10:19 pm, Ricardo ricardob...@gmail.com wrote:
 Guess what?

 var e1 = $(#firstObject);
 var e2 = $(#secondObject);

 e1.add( e2 ) is exactly what you're looking for :)

 http://docs.jquery.com/Traversing/add#expr

 On Jul 23, 1:17 am, NeilM neil.mar...@abilitation.com wrote:

  Does anyone know if it is possible to join two jQuery objects to make
  a new object.  For example...

  var e1 = $(#firstObject);
  var e2 = $(#secondObject);

  var combined = e1.add(e2);  // This is the expression I'm looking for

  Thanks.


[jQuery] Re: Listnav Umlauts and special chars

2009-07-27 Thread cdvrooman

Jack,
  taking into account the need to control the width of the alphabet
list, my original suggestion of including a configurable list of valid
letters (to cover accented characters), might not hold water because
potentially you could have well over 26 letters depending on the
language.

  The possibility of degrading special characters into their nearest
neighbor sounds like an interesting alternative, at least as far as an
ISO-8859-1 alphabet is concerned. However, I don't know how well it
would carry over to Russian, Arabic, Hebrew, etc.

  Maybe an array of special characters:
  var ln_special_chars = {a: {'a', 'á', 'à'}, 'c': {'c', 'ç'}, 'e':
{'é', 'è', 'ë'}, ... n: {'n', 'ñ'}, ... etc}
Could be implemented to degrade/consolidate special characters as
suggested by sixtyseven and/or handle a non-iso-8859-1 alphabet in its
entirety.

Also, design-wise you may not always have sufficient space to show a
standard alphabet anyway, so maybe the possibility of controlling how
listnav wraps, for example allow the specification of wrapping on
characters 'h'  'p', is something that should be planned for as well
just to cover all the bases.

Sincerely,
  Christopher Vrooman.

On Jul 26, 2:13 pm, Jack Killpatrick j...@ihwy.com wrote:
 Good idea making All a variable. You're the 2nd person in the last few
 days who had a need for that.

 And thanks for your thoughts on the special chars. As I mentioned in my
 other email a few minutes ago, I'll be adding support for that, I just
 need to think it through a bit more. It seems like it would be nice to
 have them automatically appear in the navigation, but that means losing
 control over how many things are in the nav, and therefore how wide it
 will be on the page (which could result in wrapping). One idea is to
 lump them into an other listnav item, but that doesn't seem very good,
 either. Another is to add a new row to the nav for dynamically adding
 nav links for special chars. Or the other could be a dropdown (but
 then it's items are out of view, which reduces the ability to quickly
 visually scan the list).

 Offhand, I don't know if there's an easy way (or whether it really makes
 sense logically to a user) to degrade chars to their nearest neighbor.
 I don't know enough about other languages to know.

 Thanks,
 Jack

 sixtyseven wrote:
  I ran into a problem when having umlauts as first letter in the li
  tag. They will not be shown, until I add them to the letters array.
  IMHO the better way would be to have a function, that degrades the
  letter to the next near neighbor, i.e. if it is ü, make it to u, if
  it's é make it to e, etc. Do you have any Idea how to achieve this?
  Such a function would make the listnav more multilingual. While
  speaking of this, perhaps you could make the word All a variable,
  too.

  Same thing with special chars like *,# etc. How about adding them into
  a group of its own? Probably one could handle it like this: If the
  first letter is neither a number nor a letter, it must be a special
  char.

  Hope I could explain the problem, my english is not that good.

  Greetings from Germany

  André


[jQuery] Combine JQuery objects question

2009-07-27 Thread www.voguemalls.com

who knows if it is possible to join two jQuery objects to make
a new object.  For example...

var e1 = $(#firstObject);
var e2 = $(#secondObject);

var combined = e1.add(e2);  // This is the expression I'm looking for

Thanks,


http://www.voguemalls.com


[jQuery] inserting new record

2009-07-27 Thread Ravi Mori
Hi..
 i have some doubts in usage of jqgrid. I am trying to achieve fallowing
functionality.

I have insert and edit functionality in same form. Now i have one field
called UserName, which i don't want to edit. so for that i make it
readonly as following:


{ name: 'UserName', index: 'UserName', width: 100, align: 'center', hidden:
false, editable: true, editoptions: { size: 40, readonly: true} },
But this creates problem at insertion time..i can't insert any data in
UserName at the time of inserting new record because its a readonly..

Any suggessions??


[jQuery] Re: Make width of inner div equal outer

2009-07-27 Thread Paul Collins
Hi all,

I'm completely stuck and been trying to solve this all day! Any help would
be greatly appreciated...

Basically, I have a suckerfish type navigation. It works fine with CSS and
I'm trying to add some JQuery to animate the slide-down effect. I've got
that working, but I need to have the sub-nav showing when I am on the actual
page and keep it there when you hover over it, unless you hover over a
different top level navigation. With CSS, it works fine as I add a class of
selected to the top level, but I can't work it out in JQuery. Here is my
code:

function mainmenu(){

if ($(#header ul#topNavigation li).is(.selected)){
$(this).find('div:first:visible');
}else{
$(this).find('div:first:invisible');
};

$(#header ul#topNavigation li).hover(function(){

$(this).find('div:first').css({visibility:visible,display:none}).slideDown(300);
},function(){
$(this).find('div:first').css({visibility:hidden});
});
}

// activate function
$(document).ready(function(){
mainmenu();
});

The HTML

div id=header
ul id=topNavigation
lia href=/Home/a/li
 li class=selected
a href=/About Us/a
 div class=secondLevel
ul
lia href=/Overview/a/li
 /ul
/div
 /li
lia href=/Contact/a/li
 /ul
/div

Currently, the 2nd level appears if I have the class of selected, but it
dissapears when I mouse over it. I would need it to stay there until I hover
over a different top level nav item.

Would really appreciate any help.
Thanks
Paul


[jQuery] Re: Advice needed on jQuery page to be built

2009-07-27 Thread Liam Potter


divs, updated using ajax.

gnetcon wrote:

Hello, all!

Brand new to jQuery, although I have used some apps that use jQuery in it.

I have a page I have to build using PHP and (preferably) jQuery.  I have an
immense array with anywhere from 100 to 10,000+ items in it.  I'll have a
page with 3 panes.  The first pane will list the basic info for each record
(date, time, description, etc).  When one of those items/rows is selected
(clicked on or radio button checked), I need to update 2 panes below it with
data from the same array item chosen.

Would it be better to have the panes as divs, and use jQuery to update each
div based on the selected data?  OR would it better to use frames, figure
out a way to store the array data, and view it from the framed pages, based
on what is selected?

I'm looking for any great ideas, especially from you jQuery experts out
there!  : )

TIA!
  


[jQuery] Re: Combine JQuery objects question

2009-07-27 Thread brian

appendTo()? What do you mean by join?

On Mon, Jul 27, 2009 at 11:40 AM,
www.voguemalls.comyuyuhua...@gmail.com wrote:

 who knows if it is possible to join two jQuery objects to make
 a new object.  For example...

 var e1 = $(#firstObject);
 var e2 = $(#secondObject);

 var combined = e1.add(e2);  // This is the expression I'm looking for

 Thanks,


 http://www.voguemalls.com



[jQuery] Re: Advice needed on jQuery page to be built

2009-07-27 Thread brian

And paginate the 1st div, using AJAX to refresh it with each page
for your list.

On Mon, Jul 27, 2009 at 11:58 AM, Liam Potterradioactiv...@gmail.com wrote:

 divs, updated using ajax.

 gnetcon wrote:

 Hello, all!

 Brand new to jQuery, although I have used some apps that use jQuery in it.

 I have a page I have to build using PHP and (preferably) jQuery.  I have
 an
 immense array with anywhere from 100 to 10,000+ items in it.  I'll have a
 page with 3 panes.  The first pane will list the basic info for each
 record
 (date, time, description, etc).  When one of those items/rows is selected
 (clicked on or radio button checked), I need to update 2 panes below it
 with
 data from the same array item chosen.

 Would it be better to have the panes as divs, and use jQuery to update
 each
 div based on the selected data?  OR would it better to use frames, figure
 out a way to store the array data, and view it from the framed pages,
 based
 on what is selected?

 I'm looking for any great ideas, especially from you jQuery experts out
 there!  : )

 TIA!




[jQuery] Advice needed on jQuery page to be built

2009-07-27 Thread gnetcon


Hello, all!

Brand new to jQuery, although I have used some apps that use jQuery in it.

I have a page I have to build using PHP and (preferably) jQuery.  I have an
immense array with anywhere from 100 to 10,000+ items in it.  I'll have a
page with 3 panes.  The first pane will list the basic info for each record
(date, time, description, etc).  When one of those items/rows is selected
(clicked on or radio button checked), I need to update 2 panes below it with
data from the same array item chosen.

Would it be better to have the panes as divs, and use jQuery to update each
div based on the selected data?  OR would it better to use frames, figure
out a way to store the array data, and view it from the framed pages, based
on what is selected?

I'm looking for any great ideas, especially from you jQuery experts out
there!  : )

TIA!
-- 
View this message in context: 
http://www.nabble.com/Advice-needed-on-jQuery-page-to-be-built-tp24671527s27240p24671527.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Combine JQuery objects question

2009-07-27 Thread Liam Potter


already been answered, his example was his answer.

brian wrote:

appendTo()? What do you mean by join?

On Mon, Jul 27, 2009 at 11:40 AM,
www.voguemalls.comyuyuhua...@gmail.com wrote:
  

who knows if it is possible to join two jQuery objects to make
a new object.  For example...

var e1 = $(#firstObject);
var e2 = $(#secondObject);

var combined = e1.add(e2);  // This is the expression I'm looking for

Thanks,


http://www.voguemalls.com




[jQuery] [jqModal]: sending ajax request, reload in same modal

2009-07-27 Thread jjshell

Hi,

I am using jqModal (http://dev.iceburg.net/jquery/jqModal/#examples)
to open a modal div (some will argue it's an overlayed div since
I'm not forcing focus as code below shows).

An html form is loaded using ajax. I'd like to submit this form and
load the html response in the modal.

Here's how I do it:

$('#modal-test').jqm({ajax: '@href', trigger: 'a.edit-post'});

The whole page which triggered the modal box is reloaded, not just
'#modal-test'.

How would you change it?

Regards,

-jj. :)




[jQuery] Validation with rewriting

2009-07-27 Thread Brett Ritter

I considering input rewriting (transformation, conversion, etc, use
the verb of your choice) to be an essential part of validation.

This means phone numbers, SSN, dates, credit card numbers, etc should
all accept loose input types and should be standardized for backend
processing.
(Personal Pet Peeve - sites that instruct you not to use spaces or
hyphens in credit card numbers)

This article makes the general case:

http://www.hising.net/2007/03/30/form-validation-with-javascript/

The article for the popular validation plugin notes the above article,
but doesn't offer code for this particular point (See #6):

http://bassistance.de/2007/07/04/about-client-side-form-validation-and-frameworks/

It does point out the masked input plugin, but my goal is not to
provide hints to the user on how to take additional effort but rather
to save them effort in the first place.

Both of these articles date from 2 years ago.  Googling for existing
plugins has not led me to happiness.  I'll happily write my own plugin
if it is not reinventing the wheel, but I'd love to have some
compatibility with the validate plugin.
Does anyone have suggestions for the best approach for doing so?  The
transformation can be done front-end (i.e. visible to the user,
changing the value in the inputs) or internally (standardizing the
values sent to the validate plugin), I'm not picky as to which just
yet.

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org


[jQuery] Re: How to deterine number of words in a string?

2009-07-27 Thread Liam Byrne


A letter count is FAR easier - just get the string's length.

L

Rick Faircloth wrote:

Is it as simple to do a letter count?


-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Liam Potter
Sent: Friday, July 24, 2009 6:53 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to deterine number of words in a string?


or if you really do want it as a plugin

Plugin:
(function($){
   $.fn.stringCount = function() {
  
var string = this.text();

var count = string.split( );
var result = count.length;
   
return result

   }
})(jQuery);

Use:
$(function(){
alert( $(span.string).stringCount() );
});

Liam Potter wrote:
  

you don't need a plugin, this will do it

var string = $(span.string).text();
var count = string.split( );
alert(count.length);


Conrad Cheng wrote:


Hi all,
Any jquery plugin can check number of word in a string instead using 
of .length?...


Many thanks.

Conrad
  




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.32/2266 - Release Date: 07/27/09 05:58:00


  




[jQuery] Re: My messages don't show?

2009-07-27 Thread Cesar Sanz


I takes about 3 hrs to display your first message. dunno why

- Original Message - 
From: Jon Jackson j...@jon-jackson.co.uk

To: jquery-en@googlegroups.com
Sent: Sunday, July 26, 2009 5:23 AM
Subject: [jQuery] My messages don't show?




What could I be doing wrong?

I've joined the group, posted a message (tried it twice)... but it 
doesn't show?


Jon Jackson (JimmyHill, jonj...@googlemail.com)


[jQuery] Re: Form values getting unsynchronized after ajaxsubmit [validate]

2009-07-27 Thread jackmcleod

I had 1 problem with ajaxSubmit and switched to using $.post and it
solved my problems, maybe it can be an alternative for you

On 26 juil, 01:49, anoop anoopkum...@gmail.com wrote:
 After several attempts, I have been able to consistently reproduce
 this problem. It appears that this is an issue with the ajaxSubmit in
 the form plugin and only in firefox (latest version), IE 7 does not
 seem to have this issue.

 The issue occurs in firefox only; when a page with multiple forms is
 refreshed (by hitting F5 or ctrl-r) the body of the form and the form
 header get unsynchronized. But after clicking on the reset button for
 each form it gets rectified.
 On IE 7 the refresh did not cause any issue anytime.

 I tried after removing the ajaxSubmit and the problem did not occur in
 firefox or IE.

 I have these lines which I think is the cause of the problem:

         submitHandler: function(form) {
             $(form).ajaxSubmit({
               target: 'body',
               error: function (xhr) {
                 $('.derror').text(Errors: Please fix  +
 xhr.statustext).show(fast);
             }

 It could be that I am doing something wrong, but that does not explain
 the inconsistent behavior between the 2 browsers. It was this block of
 text that I had to remove to make my forms work even after a refresh.

 Thanks,
 Anoop

 On Jul 24, 11:01 am, Anoop kumar V anoopkum...@gmail.com wrote:



  Attached an html - that shows my situation...

  In the page - clicking on any region opens the pop-up form, and once in a
  while after you submit the pop-ups are mixed up, you see Newyork details for
  the Washington tab etc. But as soon as I click on the reset button, it
  rectifies itself...

  Can somebody please help a bit? I am not able to understand / explain why
  this happens - I do not have a lot of javascript / jquery code, just the 2
  functions...

  Should I call reset for all forms after I submit? If so can someone please
  show / hint at how that can be achieved?

  Thanks,
  Anoop

  On Fri, Jul 24, 2009 at 2:09 AM, Anoop kumar V anoopkum...@gmail.comwrote:

   Hi All,

   I have a very weird issue that I have been trying to resolve for over a
   week now with no success in sight.

   I use jsp to generate a page of regional information. The regions are
   displayed as clickable blocks. On clicking each block a pop-up form opens 
   up
   with the corresponding region details like id, name and acronym. These can
   be edited and submitted as updates. There is also a last block that allows
   to create a new region which on clicking opens the same kind of form as 
   the
   others, except all the fields are blank and required.

   I am using jquery validator plugin (bassistance) to ensure that the user
   does not leave any field blank and I also use the form plugin to do an
   ajaxsubmit, so that the id enterred is not a duplicate id.

   On submitting the new region form, a new region gets created and updates
   the page fine, but intermittently when I click on the other existing 
   blocks
   the information shown in the pop-up is for a completely different region:
   for example when I click on a block labelled Washington, the popup that
   comes up shows New York, NY, 02. On clicking New York block, the same
   (correct) information is show. This does not happen always and I have
   noticed it happening only in firefox, I use firefox more often also. Also 
   if
   I take out the ajaxsubmit and do a simple form submit, it seems to not
   occur, but I need the ajaxsubmit for the id validation..
   Interestingly, when I click on the reset button on the individual form, 
   the
   values in the fields correct themselves automagically for that form..

   I also used firebug, and when I mouseover the field in the firebug 
   console,
   the values in the fields are shown correct (in forebug), except the page
   displays the incorrect info. I think this safely eliminates my java code 
   as
   the culprit... Again - when I reset the particular form, the values are
   good, but only for that form, so if I want to clean all such incorrect 
   data,
   I will have to open each form pop-up on the page and click on the reset
   button - this would not work even as a workaround.

   Below is the code if it helps:

   *** JS***
   $(function() {
   var bbap = function() {
         $('.cbnav').live('click',function(event) {
           var target = $(event.target);
           if(($(target).is(.main-title)) || ($(target).is(.cls)))
           {
             $('.details').hide();
             if($(target).is(.main-title))
               $(target).next('.details').show(450);
           } else if ($(target).is('input[type=reset]')){
               $('.derrors').hide();
               $('.errors').hide();
           }
       });
     }
     bbap();
   });

   var v = $(function() {
       $('.main-title').click(function(event) {
         var target = $(event.target);
       

[jQuery] Re: newbie question.

2009-07-27 Thread James

This:
(function() { do some stuff } )();

is known as a closure. It just runs once and it does not leave around
any global variables (that is, if you also don't set any inside this
function also).

Compared to this:
function doSomething() { // do some stuff };

The doSomething variable will exist (globally) to be available for
access again. It will exist in memory, and may possibly pollute the
global namespace. This is usually a problem if you have a lot of other
Javascript that may have same variable name conflicts (e.g. multiple
Javascript libraries). In the first example, no such global variable
will exist. It will run once, and disappear.

In your example:
(function($) { do some stuff } )(jQuery);

The $ variable (local) has the value of the jQuery (global) variable,
therefore, inside your closure, you can use $ as your jQuery variable.


On Jul 25, 6:35 am, Aleksey gabb...@gmail.com wrote:
 Well, it's a common pattern that is used when creating a jQuery
 plugin.
 A common problem doing that is the use of a '$' sign, because other
 frameworks use it too as well. I didn't try to use some frameworks
 simultaneously yet, so I didn't encountered that problem by myself.
 One of the way is to use 'jQuery' instead of '$' ('$' is a shorthand
 of 'jQuery'), and to write, for example:

 jQuery('a').click(function() { });
 instead of
 $('a').click(function() { });

 But there is another way - this pattern allows you to use '$' in your
 jQuery code without the worry of malfunctioning.

 You can read more about the creating jQuery plugin in the following
 articles:http://blog.themeforest.net/tutorials/ask-jw-decoding-self-invoking-a...http://blog.jeremymartin.name/2008/02/building-your-first-jquery-plug...http://docs.jquery.com/Tutorials

 Good luck)

 On Jul 25, 4:04 pm, Kris ilaymy...@yahoo.com wrote:

  What does this do?
  (function($) { do some stuff } )(jQuery);




[jQuery] Re: My messages don't show?

2009-07-27 Thread John Resig
All messages are moderated - so it'll depend heavily upon when we're able to
review them.

--John


On Mon, Jul 27, 2009 at 3:19 PM, Cesar Sanz the.email.tr...@gmail.comwrote:


 I takes about 3 hrs to display your first message. dunno why

 - Original Message - From: Jon Jackson j...@jon-jackson.co.uk
 To: jquery-en@googlegroups.com
 Sent: Sunday, July 26, 2009 5:23 AM
 Subject: [jQuery] My messages don't show?




 What could I be doing wrong?

 I've joined the group, posted a message (tried it twice)... but it doesn't
 show?

 Jon Jackson (JimmyHill, jonj...@googlemail.com)




[jQuery] Re: how to delay operation

2009-07-27 Thread James

You want to do this with jQuery (Javascript)? This should be done on
the server side.
A user can stop Javascript, you know. If the user submits the form and
doesn't wait for 30 seconds before going to another website, the email
will not be sent to them...

On Jul 24, 7:54 pm, bharani kumar bharanikumariyer...@gmail.com
wrote:
 Hi ,

 Am doing one support ticketing systems,

 user submit his problem through form ,

 my task is after submitted , i want to send his ticketID . to his mail , for
 track the supprt request ,

 The ticket ID not and sequential order , its random order ,

 So my idea is we write one mail function , after form submited , after the
 30sec , we run the mail function and get the ticket id from the DB using his
 emailID  and based on ticket created time as the unique ,

 ,,,no my question is , how run the mail function / any function  after
 30second,

 please advise

 Thanks

 bharani


[jQuery] embedding media

2009-07-27 Thread Pankhuri

hi all,
I'm new to jQuery.
I'm making a website for a dance institute.
I've to embed around 20 3-4min videos in my website's showcase and an
image slideshow of 70-80 images.I've found a plugin for image
slideshow that'll fetch two images at a time from a flicker or picasa
a/c but i'll have to explicitely list each image in my sourcecode.

Is there a plugin which'll help me take care of my media and site's
size too?


[jQuery] Selecting the values of radio buttons

2009-07-27 Thread briggs81

This is probably simple, but I am new to jQuery and am trying to wrap
my head around things.

Basically what I am trying to do is a very basic quiz. I have 3 groups
of radio buttons (3 questions with 4 possible answers for each
question, so.. multiple choice).

Each answer has a number value assigned to it, i.e. value=2. This
would be 2 points.

After pressing a button I need to be able to select all the radio
buttons have that been checked, and then add all their point values up
and give the user a score.

Any hints would be appreciated.


[jQuery] Re: Selecting the values of radio buttons

2009-07-27 Thread Leonardo K
Something like this:

$(button).click(function(){
var total = 0;
$(input:radio).each(function(){
total += $(this).val();
});
alert(total);
return false;
});

On Mon, Jul 27, 2009 at 16:41, briggs81 brigg...@gmail.com wrote:


 This is probably simple, but I am new to jQuery and am trying to wrap
 my head around things.

 Basically what I am trying to do is a very basic quiz. I have 3 groups
 of radio buttons (3 questions with 4 possible answers for each
 question, so.. multiple choice).

 Each answer has a number value assigned to it, i.e. value=2. This
 would be 2 points.

 After pressing a button I need to be able to select all the radio
 buttons have that been checked, and then add all their point values up
 and give the user a score.

 Any hints would be appreciated.



[jQuery] Re: Selecting the values of radio buttons

2009-07-27 Thread James

It sounds strange that value=2 would be the number of points.
Usually, a value would be used to indicate a unique answer for a
question. Usually, 1, 2, 3, 4 if you have 4 possible answers for one
question. I would suggest using the ID or CLASS attribute, or
Javascript objects to store that type of info.
Do you have another attribute that determines what the correct
answer is for a question? Or is there no correct answer? Just a
selection?

Otherwise, to do what you want to do, you can do something like
(untested):
(You might have to double-check this, but it's an idea.)

var total = 0;

$(#submit_btn).click(function() {
$(input[name^='question_']).each(function() {
var answer_value = $(':checked', this).val();
if (answer_value)
total += parseInt(answer_value);
});
});

Question 1:
input type=radio name=question_1 value=1 Answer 1
input type=radio name=question_1 value=2 Answer 2
input type=radio name=question_1 value=3 Answer 3
input type=radio name=question_1 value=4 Answer 4

Question 2:
input type=radio name=question_2 value=1 Answer 1
input type=radio name=question_2 value=2 Answer 2
input type=radio name=question_2 value=3 Answer 3
input type=radio name=question_2 value=4 Answer 4

input type=button id=submit_btn value=Submit


On Jul 27, 9:41 am, briggs81 brigg...@gmail.com wrote:
 This is probably simple, but I am new to jQuery and am trying to wrap
 my head around things.

 Basically what I am trying to do is a very basic quiz. I have 3 groups
 of radio buttons (3 questions with 4 possible answers for each
 question, so.. multiple choice).

 Each answer has a number value assigned to it, i.e. value=2. This
 would be 2 points.

 After pressing a button I need to be able to select all the radio
 buttons have that been checked, and then add all their point values up
 and give the user a score.

 Any hints would be appreciated.


[jQuery] Re: Selecting the values of radio buttons

2009-07-27 Thread ButtersRugby

var group1 =  $('input[name=group1]:checked').attr(value);
var group2 =  $('input[name=group2]:checked').attr(value);
var group3 =  $('input[name=group3]:checked').attr(value);

This will grab the value of the selected radio button within each of
your groups.

Then do some math to add up your variables.

so,
var result = (group1+group2+group3);
console.log(result);  // this will show the result of the variable in
firebug. If you are that much of a newbie, embrace firebug. learn to
love it and harness it's power.








On Jul 27, 3:41 pm, briggs81 brigg...@gmail.com wrote:
 This is probably simple, but I am new to jQuery and am trying to wrap
 my head around things.

 Basically what I am trying to do is a very basic quiz. I have 3 groups
 of radio buttons (3 questions with 4 possible answers for each
 question, so.. multiple choice).

 Each answer has a number value assigned to it, i.e. value=2. This
 would be 2 points.

 After pressing a button I need to be able to select all the radio
 buttons have that been checked, and then add all their point values up
 and give the user a score.

 Any hints would be appreciated.


[jQuery] Re: How to deterine number of words in a string?

2009-07-27 Thread ButtersRugby

I agree Liam. If you are doing a letter count then spaces punctuation
etc all count towards your supposed limit. Word Counts are typically
useless. :|

On Jul 27, 3:09 pm, Liam Byrne l...@onsight.ie wrote:
 A letter count is FAR easier - just get the string's length.

 L

 Rick Faircloth wrote:
  Is it as simple to do a letter count?

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
  Behalf Of Liam Potter
  Sent: Friday, July 24, 2009 6:53 AM
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: How to deterine number of words in a string?

  or if you really do want it as a plugin

  Plugin:
  (function($){
     $.fn.stringCount = function() {

          var string = this.text();
          var count = string.split( );
          var result = count.length;

          return result
     }
  })(jQuery);

  Use:
  $(function(){
      alert( $(span.string).stringCount() );
  });

  Liam Potter wrote:

  you don't need a plugin, this will do it

  var string = $(span.string).text();
  var count = string.split( );
  alert(count.length);

  Conrad Cheng wrote:

  Hi all,
  Any jquery plugin can check number of word in a string instead using
  of .length?...

  Many thanks.

  Conrad

  

  No virus found in this incoming message.
  Checked by AVG -www.avg.com
  Version: 8.5.392 / Virus Database: 270.13.32/2266 - Release Date: 
  07/27/09 05:58:00


[jQuery] consistently unable to get return false to work, why?

2009-07-27 Thread pedalpete

So, this isn't related to any one bit of code, but it seems to be a
problem I run into almost everytime i need to stop a form or link for
doing what it was originally intended to do (submit).

Now, i have used return false; many times, but it never works at
first.
I'm never sure what I end up changing, but something changes, and then
all of a sudden it works, and I am once again left stumped as to what
I did.

Yesterday, i renamed a class, and all of a sudden, it worked. Changed
the class back, and guess what! It still works, though it hadn't
before ...r


Today, i'm trying to use a submit, check the e-mail address and then
submit the form via ajax.
Once again, i can't seem to stop the form from submitting.

There are no other javascript errors coming up in firefox.
my alerts work, so i'm in the right function, but then...the form
submits.

code
  jQuery('div#selected form#getEmail').livequery('submit', function
(){
var sid=jQuery('input.emailsButton', this).attr('id');
var emailAddress=jQuery('input#email', this).val();
alert(sid);
if(isValidEmailAddress(emailAddress)) {
alert('works');
$(input#email).after(works);
} else {
alert('errored');
$(input#email, this).after(label class='error'Email is not
valid!/label);

}
return false;
  });
/code

I've tried moving the return false; into the if/else, but no changes.

As mentioned, i think the biggest problem isn't just with this code.
There is something I seem to be doing consistently.

Thanks


[jQuery] Re: consistently unable to get return false to work, why?

2009-07-27 Thread John Resig
It looks like you're using the old liveQuery plugin. Why not just use
.bind() or .live()?

--John


On Mon, Jul 27, 2009 at 5:11 PM, pedalpete p...@hearwhere.com wrote:


 So, this isn't related to any one bit of code, but it seems to be a
 problem I run into almost everytime i need to stop a form or link for
 doing what it was originally intended to do (submit).

 Now, i have used return false; many times, but it never works at
 first.
 I'm never sure what I end up changing, but something changes, and then
 all of a sudden it works, and I am once again left stumped as to what
 I did.

 Yesterday, i renamed a class, and all of a sudden, it worked. Changed
 the class back, and guess what! It still works, though it hadn't
 before ...r


 Today, i'm trying to use a submit, check the e-mail address and then
 submit the form via ajax.
 Once again, i can't seem to stop the form from submitting.

 There are no other javascript errors coming up in firefox.
 my alerts work, so i'm in the right function, but then...the form
 submits.

 code
  jQuery('div#selected form#getEmail').livequery('submit', function
 (){
var sid=jQuery('input.emailsButton', this).attr('id');
var emailAddress=jQuery('input#email', this).val();
alert(sid);
if(isValidEmailAddress(emailAddress)) {
alert('works');
$(input#email).after(works);
} else {
alert('errored');
$(input#email, this).after(label class='error'Email is
 not
 valid!/label);

}
return false;
  });
 /code

 I've tried moving the return false; into the if/else, but no changes.

 As mentioned, i think the biggest problem isn't just with this code.
 There is something I seem to be doing consistently.

 Thanks


[jQuery] Re: Validation with rewriting

2009-07-27 Thread Jörn Zaefferer

You could start by writing custom methods for each of these input
types, and where possible, delegate to the existing methods:
http://docs.jquery.com/Plugins/Validation/Validator/addMethod

What do you think?

Jörn

On Mon, Jul 27, 2009 at 8:42 PM, Brett Ritterswift...@swiftone.org wrote:

 I considering input rewriting (transformation, conversion, etc, use
 the verb of your choice) to be an essential part of validation.

 This means phone numbers, SSN, dates, credit card numbers, etc should
 all accept loose input types and should be standardized for backend
 processing.
 (Personal Pet Peeve - sites that instruct you not to use spaces or
 hyphens in credit card numbers)

 This article makes the general case:

 http://www.hising.net/2007/03/30/form-validation-with-javascript/

 The article for the popular validation plugin notes the above article,
 but doesn't offer code for this particular point (See #6):

 http://bassistance.de/2007/07/04/about-client-side-form-validation-and-frameworks/

 It does point out the masked input plugin, but my goal is not to
 provide hints to the user on how to take additional effort but rather
 to save them effort in the first place.

 Both of these articles date from 2 years ago.  Googling for existing
 plugins has not led me to happiness.  I'll happily write my own plugin
 if it is not reinventing the wheel, but I'd love to have some
 compatibility with the validate plugin.
 Does anyone have suggestions for the best approach for doing so?  The
 transformation can be done front-end (i.e. visible to the user,
 changing the value in the inputs) or internally (standardizing the
 values sent to the validate plugin), I'm not picky as to which just
 yet.

 --
 Brett Ritter / SwiftOne
 swift...@swiftone.org



[jQuery] Re: jQuery + Ajax request

2009-07-27 Thread James

IDs in HTML are unique. You cannot have multiple elements with
id=removeSearchword.
You can use the CLASS attribute instead, or make unique IDs like:
id=removeSearchword_1, id=removeSearchword_2, ...
and then change your selector to:

$([id^=removeSearchword_]).click(...);

On Jul 26, 10:04 am, Ayah e...@eckan.be wrote:
 Hello!
 Im trying to build a AJAX request with jQuery,
 the function should work like this.
 I have a list of words like this.
 [code]
 ul id=searchword_ul
              li id=searchword_kuken
                  ?=form_open('adminpanel/testformremove')?
                  div style=display:none
                      ?=form_input('sokord_id', '3', 'id=sokord_id')?

                      ?=form_input('register_id', '1',
 'id=register_id')?
                      ?=form_input('sokordet', 'kuken',
 'id=sokordet')?
                  /div
                  kuken a href= id=removeSearchwordx/a
                 ?=form_close()?

              /li
              li id=searchword_test
                  ?=form_open('adminpanel/testformremove')?
                  div style=display:none
                      ?=form_input('sokord_id', '3', 'id=sokord_id')?

                      ?=form_input('register_id', '1',
 'id=register_id')?
                      ?=form_input('sokordet', 'test',
 'id=sokordet')?
                  /div
                  test a href= id=removeSearchwordx/a
                  ?=form_close()?
              /li
          /ul
       /div
 [/code]

 and a Javascript like this
 [code]
 $(#removeSearchword).click(function(){
                 var sokord_id = $(#sokord_id).val();
                 var register_id = $(#register_id).val();
                 var sokordet = $(#sokordet).val();

                 $.post(?=base_url()?index.php/adminpanel/
 testformremove,
                    { sokord_id: sokord_id, register_id: register_id },
                        function(data){
                             $(#searchword_+ sokordet).slideUp
 (normal, function() {

                             $(#searchword_+ sokordet).before('');
                         });
                     }
                 );
                 return false;
         });
 [/code]

 The problem im having, is that i can only press the x (remove) link
 on the first one, not on the next one. Nothing happens when i press
 the secound x.

 Why is that?


[jQuery] Re: Fetching data from callback with $.ajax

2009-07-27 Thread James

If you want a global variable, set a global variable.

var isAuthenticated = false;

$(document).ready(function(){

  // do your ajax here and set: isAuthenticated = true;
  // in your success callback

});

On Jul 26, 5:27 am, FrenchiINLA mamali.sohe...@gmail.com wrote:
 I would do like that:
 isAuthenticated function return true or false according the entry,
 then check if is Authenticated, ajax to your php something like
 if(isAuthenticated($('#username').val(), $('#password').val())) {

 $ajax(
 {
 --
 --
 success: function(msg){
 alert(msg=='authenticated')}
 }

 );

 }

 On Jul 26, 3:56 am, Sander Thalen stha...@gmail.com wrote:

  Hello all,

  I've recently started with jQuery because I wanted to use it for posting
  details from an login form to a PHP script which should return whether the
  user is authenticated or not.

  For this I use $.ajax, because of it's flexibility and I prefer to use it in
  this implementation. Reading (jQuery docs and examples) and searching a lot
  did not solve me on one issue: fetching the data in the callback to the
  global scope. This one is driving me crazy.

  Here is the code:
  script type=text/javascript
      $(document).ready(function(){
          var form = $('#form');
          form.submit(function(){ // Only execute this function on submit
              if(isAuthenticated($('#username').val(), $('#password').val()))
  {
                  return true; // I only want the form to be submitted when
  the credentials are valid (found to be valid by the PHP script)
              } else {
                  return false;
              }
          });

          function isAuthenticated(username, password) { // This function call
  the PHP script to ask whether the credentials are valid or not.
              $.ajax({
                  type: POST,
                  url: json.php?module=loginaction=authenticate,
                  data: username= + username + password= + password,
                  success: function(msg) {
                      alert(msg); // This returns 'authenticated' in plain
  text (at the moment) from the PHP script. Functions fine or course, but I
  want to use it outside this function. How??
                  }
              });

             And here is why I want this to work:
              if(msg == authenticated) { // This function should be able to
  read the var 'msg' from the callback in the function above. How?
                  alert(Outside:  + msg); // At this point, msg is of course
  undefined.
                  return true;
              }
          }
      });
      /script

  So the only question actually is, how can I let the function that should
  check the message of the response know that 'msg' has been set?

  I hope this makes it clear what I mean ;)

  Thanks,
  Sander




[jQuery] Re: Validation with rewriting

2009-07-27 Thread Brett Ritter

On Mon, Jul 27, 2009 at 5:20 PM, Jörn
Zaeffererjoern.zaeffe...@googlemail.com wrote:
 You could start by writing custom methods for each of these input
 types, and where possible, delegate to the existing methods:
 http://docs.jquery.com/Plugins/Validation/Validator/addMethod

If I'm following you, you're saying to have validation that accepts
the loose input and considers them all valid.  That doesn't help
me sanitize for the backend though.
On submission, that Phone number should come across as the proper
format.  This also complicates the validation methods considerably.

Or am I misunderstanding you?

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org


[jQuery] Problem using toggle() function on IE8

2009-07-27 Thread Vincenzo Ferme

Hi, i’m Vincenzo, a web developer from Italy. I use your ajax code
following the guide ad the example: 
http://www.javascripttoolbox.com/jquery/?doctype=strict
. I have some question about my work with your code, if can answer me.

Here the question:

The problem is that my code do not run on explorer 8, when I click on
td where I apply the function, child td are not showed.

Here the code:

%
dim sqlcat, idcat, nome, pos, citta, indirizzo, telefono, cellulare,
sito, mail, persona, arrivare, descrizione, tipologia, mappa,
numcatpres

'- ELENCO RISORSE
-'
sub listRisorse()
%
br /
h1GESTIONE CATEGORIE/RISORSE/h1
div id=notice%= request(notice) %/div
p class=center
input type=button value=Inserisci Nuova Categoria
onclick=window.location.href='%= url %?action=newcat' /
%
  'Conto le categorie perchè il pulsante per aggiungere 
contenuti si
deve attivare solo in caso vi siano categorie
  sqlcat=SELECT COUNT(*) AS numcatpres FROM Categorie
  dbOpen(sqlcat)
  numcatpres=objRS(numcatpres)
  dbClose(true)
  if numcatpres0 then
%
nbsp;nbsp;
input type=button value=Inserisci Nuovo Contenuto
onclick=window.location.href='%= url %?action=new' /
% end if %
!--Precarico le immagini necessarie--
img src=../../images/frecciadown.png style=display:none;
visibility:hidden /
img src=../../images/frecciaup.png style=display:none;
visibility:hidden /
br /br /
/p
%

'Seleziono le eventuali categorie presenti
sqlcat=SELECT C.ID AS idcat, C.nome AS nome, C.pos AS pos FROM
Categorie C ORDER BY C.pos

dbOpen(sqlcat)

if not objRS.EOF then
%
 script
 $(function() {
$('td.title')
.click(function(){
$('tr').siblings('.child-'+this.id).toggle();

if 
($('div.visualizza'+this.id).css('background-image').search(/
frecciadown.png/)!=-1 ) {
$('div.visualizza'+this.id).css('background-image', url
(/images/frecciaup.png));

$('div.visualizza'+this.id).attr(title,Nascondi i contenuti);

$('tr[alt^=bottom'+this.id+']').toggle();
} else {
$('div.visualizza'+this.id).css('background-image', url
(/images/frecciadown.png));

$('div.visualizza'+this.id).attr(title,Mostra i contenuti);

$('tr[alt^=bottom'+this.id+']').toggle();
}

 });
$('div.[class^=visualizza]').css(cursor,pointer);
$('div.[class^=visualizza]').css(background-image, 
url(/images/
frecciadown.png));
$('div.[class^=visualizza]').attr(title,Mostra i 
contenuti);
$('tr[class^=child-]').hide().children('td');
$('tr[alt^=bottomriga]').hide();
% if request(cat)  then %
$('tr[class^=child-riga% =request(cat)%]').toggle();
$('tr[alt^=bottomriga% =request(cat)%]').toggle()
$('div.visualizzariga'+% 
=request(cat)%).attr(title,Nascondi
i contenuti);
$('div.visualizzariga'+% =request(cat)%).css('background-
image', url(/images/frecciaup.png));
% end if %
 });
 /script
%
dim counter, titlecat, classtag
counter=0
titlecat=0

DO WHILE NOT objRS.EOF

'Seleziono gli eventuali contenuti associati alla categoria
sql=SELECT nome FROM Risorse WHERE IDcat=  objRS(idcat)
dbOpen2(sql)
if not objRS2.EOF then
   classtag=title
else
   classtag=titleno
end if
titlecat=objRS(idcat)
%
table id=tabellaRisorse

tbody
   tr
   td colspan=4
   table width=100% style=height:21px;
   tr
   td class=%=classtag% id=riga% =titlecat %
style=width: 20px; height:21px;
   div style=float:left; width:20px; height: 21px; margin-
right: 5px; margin-top: 2px; class=visualizzariga% =titlecat
%nbsp;/div/td
   td
   div style=left: 50%; float: left; margin-top:2px;
   b id=% =objRS(idcat)% class=edit_area%= UCase
(objRS(nome)) %/b
   /div
   /td
   td width=155 style=text-align:left;padding-bottom:
2px;
   bPos:/b b id=% =objRS(idcat)%
class=edit_area_pos%= objRS(pos) %/b
   /td
   td width=30 style=text-

[jQuery] how do you make superfish a global include and dynamically write 'current' class?

2009-07-27 Thread lorenzo816

I racking my brain because I can't use PHP for this site.
:-(

I have used all the different variations of suckerfish and superfish
for a long time now.
With this version to help alleviate massive updating,  I want to make
this one a global include and have the script pick up the page URL and
write 'class=current in the li or the href.

I'm thinking some mix of the navbar version of this:
http://users.tpg.com.au/j_birch/plugins/superfish/#examples

and this:
http://onerutter.com/jquery/jquery-highlight-navigation-menu-v02-script.html

but its not working for me.

Can anyone help out?
please and thanks


[jQuery] JQuery method to update one form element with value from another

2009-07-27 Thread OccasionalFlyer

   I need to make a change to a web page that has lots of JQuery
things in it, it appears.  Not knowing anything about the actual use
of JQuery, however, while I will start looking at the doc, can someone
help me with what to look for in a 4000+ line file to find out where
the value is being set for the hidden field. I have been unable to
identify this.  There appears to be no onChange or onSubmit JavaScript
call. I have been given this file with the need to figure this out
right away, with a very tight timeline to make many changes, so this
one item can't take the time required to start learning the whole of
JQuery before I can make a change.  Thanks.


[jQuery] Re: Validation with rewriting

2009-07-27 Thread Jörn Zaefferer

Having JS sanitize for the backend is somewhat dubious, I'd not go
there, but you probably don't want to discuss that.

Anyway, a validation method has access to the validate element, so you
could as well write a method that just sanitizes, nothing else.
Combine that with a strict validation method, ala:

rules: {
  ssnfield: {
required: true
ssncleaner: true,
ssn: ssn
  }
}

No change to required needed. ssncleaner would always return true, and
change the input value; ssn would just validate a strict ssn.

A very simple and general sanitizer would just trim whitespace - the
plugin did that in earlier versions, but that wasn't desired in
general:

$.validator.addMethod(trim, function(value, element) {
  element.value = $.trim(value);
  return true;
});

That seems to be quite flexible to me.

Jörn

On Mon, Jul 27, 2009 at 11:28 PM, Brett Ritterswift...@swiftone.org wrote:

 On Mon, Jul 27, 2009 at 5:20 PM, Jörn
 Zaeffererjoern.zaeffe...@googlemail.com wrote:
 You could start by writing custom methods for each of these input
 types, and where possible, delegate to the existing methods:
 http://docs.jquery.com/Plugins/Validation/Validator/addMethod

 If I'm following you, you're saying to have validation that accepts
 the loose input and considers them all valid.  That doesn't help
 me sanitize for the backend though.
 On submission, that Phone number should come across as the proper
 format.  This also complicates the validation methods considerably.

 Or am I misunderstanding you?

 --
 Brett Ritter / SwiftOne
 swift...@swiftone.org



[jQuery] jquery lightbox problem

2009-07-27 Thread huminuh83


I'm using a gallery scrollable component for thumbnails. When a user clicks
on the thumbnails it loads that larger version of the image into a div on
the same page. All the large images are already loaded into the div.

My problem is when a user goes to click on the larger version of the image I
want it to open with lightbox, but no matter which thumbnail they click on,
it always starts at the first image in the lightbox. You can see the problem
replicated here.

http://www.tsutsumidaphoto.com/Mihoko/akiko3.php

So if you click on the third thumbnail, then click on the large version of
that it opens up the first image and not the third.

Any help / comments would be greatly appreciated, and thanks for taking the
time! I'm thinking it has something to do with the way I'm loading the large
images into the div (that they are already all there).

huminuh83
-- 
View this message in context: 
http://www.nabble.com/jquery-lightbox-problem-tp24689204s27240p24689204.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] hoverIntent not working?

2009-07-27 Thread Mat

Here is my simple bit of JS that isn't working;

$('#trigger').hoverIntent(function(){$('#info').slideDown('500')});

Maybe it is conflicting with the other plugins I am using; scrollTo,
localScroll and serialScroll? (I don't see why it would.)

Thanks in advance, Mat.


[jQuery] (validate) multiple error error messages per input

2009-07-27 Thread jckos

Hi,

If I  focus on a field multiple times or submit the form multiple
times, I the script adds multiple error messages per field, both valid
and error classes, depending on the data entered.

Any suggestions?

Thanks,

John





[jQuery] Re: consistently unable to get return false to work, why?

2009-07-27 Thread pedalpete

Thanks John,

I wasn't familiar with the .live() before, but of course I'll use that
where I can.

Though I'm honoured and humbled by your response, unfortunately, in
this case, I'm using a 'submit', and the documentation says i can't
use .live on submit currently. (I did try and, and it didn't work).

.bind doesn't seem as efficient, as I'll be regularly binding/
unbinding, but I've added that anyway, and still after the alerts, the
form submits.
As the form itself is created on the fly, i've put the bind inside the
function which creates the form, and unbind before the form is first
created so that i'm not stuck with the old data.

Unfortunately,  i'm still stuck with the original problem, return
false; appears to be ignored.




On Jul 27, 2:14 pm, John Resig jere...@gmail.com wrote:
 It looks like you're using the old liveQuery plugin. Why not just use
 .bind() or .live()?

 --John



 On Mon, Jul 27, 2009 at 5:11 PM, pedalpete p...@hearwhere.com wrote:

  So, this isn't related to any one bit of code, but it seems to be a
  problem I run into almost everytime i need to stop a form or link for
  doing what it was originally intended to do (submit).

  Now, i have used return false; many times, but it never works at
  first.
  I'm never sure what I end up changing, but something changes, and then
  all of a sudden it works, and I am once again left stumped as to what
  I did.

  Yesterday, i renamed a class, and all of a sudden, it worked. Changed
  the class back, and guess what! It still works, though it hadn't
  before ...r

  Today, i'm trying to use a submit, check the e-mail address and then
  submit the form via ajax.
  Once again, i can't seem to stop the form from submitting.

  There are no other javascript errors coming up in firefox.
  my alerts work, so i'm in the right function, but then...the form
  submits.

  code
       jQuery('div#selected form#getEmail').livequery('submit', function
  (){
         var sid=jQuery('input.emailsButton', this).attr('id');
         var emailAddress=jQuery('input#email', this).val();
         alert(sid);
         if(isValidEmailAddress(emailAddress)) {
         alert('works');
                 $(input#email).after(works);
         } else {
                 alert('errored');
                 $(input#email, this).after(label class='error'Email is
  not
  valid!/label);

         }
         return false;
       });
  /code

  I've tried moving the return false; into the if/else, but no changes.

  As mentioned, i think the biggest problem isn't just with this code.
  There is something I seem to be doing consistently.

  Thanks


[jQuery] Re: consistently unable to get return false to work, why?

2009-07-27 Thread James

If the return false fails, it's usually something wrong with parsing
your Javascript that causes the problem.
For example:
$(input#email).after(works);

It's missing a closing quote () after email.

On Jul 27, 12:28 pm, pedalpete p...@hearwhere.com wrote:
 Thanks John,

 I wasn't familiar with the .live() before, but of course I'll use that
 where I can.

 Though I'm honoured and humbled by your response, unfortunately, in
 this case, I'm using a 'submit', and the documentation says i can't
 use .live on submit currently. (I did try and, and it didn't work).

 .bind doesn't seem as efficient, as I'll be regularly binding/
 unbinding, but I've added that anyway, and still after the alerts, the
 form submits.
 As the form itself is created on the fly, i've put the bind inside the
 function which creates the form, and unbind before the form is first
 created so that i'm not stuck with the old data.

 Unfortunately,  i'm still stuck with the original problem, return
 false; appears to be ignored.

 On Jul 27, 2:14 pm, John Resig jere...@gmail.com wrote:

  It looks like you're using the old liveQuery plugin. Why not just use
  .bind() or .live()?

  --John

  On Mon, Jul 27, 2009 at 5:11 PM, pedalpete p...@hearwhere.com wrote:

   So, this isn't related to any one bit of code, but it seems to be a
   problem I run into almost everytime i need to stop a form or link for
   doing what it was originally intended to do (submit).

   Now, i have used return false; many times, but it never works at
   first.
   I'm never sure what I end up changing, but something changes, and then
   all of a sudden it works, and I am once again left stumped as to what
   I did.

   Yesterday, i renamed a class, and all of a sudden, it worked. Changed
   the class back, and guess what! It still works, though it hadn't
   before ...r

   Today, i'm trying to use a submit, check the e-mail address and then
   submit the form via ajax.
   Once again, i can't seem to stop the form from submitting.

   There are no other javascript errors coming up in firefox.
   my alerts work, so i'm in the right function, but then...the form
   submits.

   code
        jQuery('div#selected form#getEmail').livequery('submit', function
   (){
          var sid=jQuery('input.emailsButton', this).attr('id');
          var emailAddress=jQuery('input#email', this).val();
          alert(sid);
          if(isValidEmailAddress(emailAddress)) {
          alert('works');
                  $(input#email).after(works);
          } else {
                  alert('errored');
                  $(input#email, this).after(label class='error'Email is
   not
   valid!/label);

          }
          return false;
        });
   /code

   I've tried moving the return false; into the if/else, but no changes.

   As mentioned, i think the biggest problem isn't just with this code.
   There is something I seem to be doing consistently.

   Thanks




[jQuery] Re: Validation with rewriting

2009-07-27 Thread Brett Ritter

On Mon, Jul 27, 2009 at 6:06 PM, Jörn
Zaeffererjoern.zaeffe...@googlemail.com wrote:

 Having JS sanitize for the backend is somewhat dubious, I'd not go
 there, but you probably don't want to discuss that.

I think we're in agreement there, actually.  JS provides no security
and shouldn't be relied on.  Rather I'm looking at a progressive
enhancement feature:  Server-side validation can reject (for example)
any CC Number that isn't 16 digits.  User's w/o JS can get the
functional basics (please enter your CC number without hyphens or
spaces) The JS front end will accept multiple formats (16 digits, 4
sets of 4 digits with whitespace, etc) and translate them to what the
server demands.

This is more impressive with string inputs for dates, phone numbers,
etc.  Typing 8005551212 is easy on the user, and seeing (800)
555-1212 is better for their visual parsing.

 Anyway, a validation method has access to the validate element, so you

Ah, this is the essential piece I was missing.  I'll code a few tests
and report back in a few days.  Thanks for the help!

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org


[jQuery] Re: How to deterine number of words in a string?

2009-07-27 Thread RobG



On Jul 28, 5:09 am, Liam Byrne l...@onsight.ie wrote:
 A letter count is FAR easier - just get the string's length.

The length of the string will give you a *character* count. I would
not inlcude punctuation, white space, etc. in a *letter* count.  For
number of letters, try:

  s.replace(/[^a-zA-Z]/g,'').length;


--
Rob


[jQuery] Re: How to deterine number of words in a string?

2009-07-27 Thread Conrad Cheng
The most important part in my string is..it contains chinese characters...
For an example

I come from 香港---so totally 5 words instead of length = 15

Thx all of you.




On Tue, Jul 28, 2009 at 7:23 AM, RobG robg...@gmail.com wrote:




 On Jul 28, 5:09 am, Liam Byrne l...@onsight.ie wrote:
  A letter count is FAR easier - just get the string's length.

 The length of the string will give you a *character* count. I would
 not inlcude punctuation, white space, etc. in a *letter* count.  For
 number of letters, try:

  s.replace(/[^a-zA-Z]/g,'').length;


 --
 Rob


[jQuery] Re: Combine JQuery objects question

2009-07-27 Thread Kean

Why post the question if you had the answer?

On Jul 27, 8:40 am, www.voguemalls.com yuyuhua...@gmail.com wrote:
 who knows if it is possible to join two jQuery objects to make
 a new object.  For example...

 var e1 = $(#firstObject);
 var e2 = $(#secondObject);

 var combined = e1.add(e2);  // This is the expression I'm looking for

 Thanks,

 http://www.voguemalls.com


[jQuery] Re: newbie question.

2009-07-27 Thread Michael Geary

That's a great explanation, James. I hope you won't mind if I nitpick a
point of terminology.

The code you were talking about is not a closure:

(function() { /* do some stuff */ })();

As you described, the advantage of this code is that any variables you
define inside the function won't pollute the global namespace. But that
doesn't make it a closure. A more accurate way to describe it is an
anonymous function expression that is called immediately. 

Here's a version of the code that doesn't use the anonymous function
expression. It's more obvious how this works:

function someUniqueName() {
/* do some stuff */
}

someUniqueName();

That code does the same thing, except that it also leaves someUniqueName
defined in the global namespace (if it is a global function). As you
explained, the first version of the code avoids that namespace pollution.
Both versions do share the advantage that local variables inside the
function won't go into the global namespace.

Now, either version of the code may *create* a closure, or it may not,
depending on what some stuff is.

For example, this code does *not* create a closure:

(function() {
var text = 'hi';
alert( text );
})();

Whereas this code *does* create a closure:

(function() {
var text = 'hi';
setTimeout( function() {
alert( text );
}, 1000 );
})();

What's the difference? The first example has a local variable 'text' which
is used temporarily while the function is running, but there is no need to
preserve that variable (or anything else in the function) after the function
returns. So as soon as the function returns, the 'text' variable is
available for garbage collection.

The second example also has a local variable 'text', but this variable
*cannot* be released when the function returns. That's because the variable
is referenced in the setTimeout() callback function, which will be called a
full second later - long after the original function has return.

So in this case, the 'text' variable has to be preserved for its later use
in the setTimeout() callback.

That's what a closure is. It's when JavaScript has to preserve a function's
local variables (including any function arguments) after the function
returns. If there's no need to keep those variables in existence, then
JavaScript doesn't create a closure.

This code creates a closure just like the last example does:

function anotherUniqueName() {
var text = 'hi';
setTimeout( function() {
alert( text );
}, 1000 );
}

anotherUniqueName();

It's not the specific form of the function call that makes it a closure or
not, it's whether JavaScript has to preserve the function call's context
after the function returns.

For the gory details, here's the standard reference on JavaScript
closures:

http://www.jibbering.com/faq/faq_notes/closures.html

-Mike

 From: James
 
 This:
 (function() { do some stuff } )();
 
 is known as a closure. It just runs once and it does not 
 leave around any global variables (that is, if you also don't 
 set any inside this function also).
 
 Compared to this:
 function doSomething() { // do some stuff };
 
 The doSomething variable will exist (globally) to be 
 available for access again. It will exist in memory, and may 
 possibly pollute the global namespace. This is usually a 
 problem if you have a lot of other Javascript that may have 
 same variable name conflicts (e.g. multiple Javascript 
 libraries). In the first example, no such global variable 
 will exist. It will run once, and disappear.
 
 In your example:
 (function($) { do some stuff } )(jQuery);
 
 The $ variable (local) has the value of the jQuery (global) 
 variable, therefore, inside your closure, you can use $ as 
 your jQuery variable.

 On Jul 25, 6:35 am, Aleksey gabb...@gmail.com wrote:
  Well, it's a common pattern that is used when creating a jQuery 
  plugin.
  A common problem doing that is the use of a '$' sign, because other 
  frameworks use it too as well. I didn't try to use some frameworks 
  simultaneously yet, so I didn't encountered that problem by myself.
  One of the way is to use 'jQuery' instead of '$' ('$' is a 
 shorthand 
  of 'jQuery'), and to write, for example:
 
  jQuery('a').click(function() { });
  instead of
  $('a').click(function() { });
 
  But there is another way - this pattern allows you to use 
 '$' in your 
  jQuery code without the worry of malfunctioning.
 
  You can read more about the creating jQuery plugin in the following 
  
 articles:http://blog.themeforest.net/tutorials/ask-jw-decoding-self-in
  
 voking-a...http://blog.jeremymartin.name/2008/02/building-your-first-j
  query-plug...http://docs.jquery.com/Tutorials
 
  Good luck)
 
  On Jul 25, 4:04 pm, Kris ilaymy...@yahoo.com wrote:
 
   What does this do?
   (function($) { do some stuff } )(jQuery);
 
 
 



[jQuery] Re: Form values getting unsynchronized after ajaxsubmit [validate]

2009-07-27 Thread Anoop kumar V
Thanks so much for the response - I was doubtful if my posts were even
making it into this list...

Yes - it is clear to me that there is a wierd and unknown issue with the
ajaxsubmit and I am trying other options - the $.ajax and the $.get/$.post.

I will try to debug a bit more if I can pinpoint the issue - otherwise I
will just open an issue and hope the people more familiar with the form
plugin take notice and resolve it.

Thanks again,
Anoop


On Mon, Jul 27, 2009 at 12:12 PM, jackmcleod jackmcl...@infocode007.comwrote:


 I had 1 problem with ajaxSubmit and switched to using $.post and it
 solved my problems, maybe it can be an alternative for you

 On 26 juil, 01:49, anoop anoopkum...@gmail.com wrote:
  After several attempts, I have been able to consistently reproduce
  this problem. It appears that this is an issue with the ajaxSubmit in
  the form plugin and only in firefox (latest version), IE 7 does not
  seem to have this issue.
 
  The issue occurs in firefox only; when a page with multiple forms is
  refreshed (by hitting F5 or ctrl-r) the body of the form and the form
  header get unsynchronized. But after clicking on the reset button for
  each form it gets rectified.
  On IE 7 the refresh did not cause any issue anytime.
 
  I tried after removing the ajaxSubmit and the problem did not occur in
  firefox or IE.
 
  I have these lines which I think is the cause of the problem:
 
  submitHandler: function(form) {
  $(form).ajaxSubmit({
target: 'body',
error: function (xhr) {
  $('.derror').text(Errors: Please fix  +
  xhr.statustext).show(fast);
  }
 
  It could be that I am doing something wrong, but that does not explain
  the inconsistent behavior between the 2 browsers. It was this block of
  text that I had to remove to make my forms work even after a refresh.
 
  Thanks,
  Anoop
 
  On Jul 24, 11:01 am, Anoop kumar V anoopkum...@gmail.com wrote:
 
 
 
   Attached an html - that shows my situation...
 
   In the page - clicking on any region opens the pop-up form, and once in
 a
   while after you submit the pop-ups are mixed up, you see Newyork
 details for
   the Washington tab etc. But as soon as I click on the reset button, it
   rectifies itself...
 
   Can somebody please help a bit? I am not able to understand / explain
 why
   this happens - I do not have a lot of javascript / jquery code, just
 the 2
   functions...
 
   Should I call reset for all forms after I submit? If so can someone
 please
   show / hint at how that can be achieved?
 
   Thanks,
   Anoop
 
   On Fri, Jul 24, 2009 at 2:09 AM, Anoop kumar V anoopkum...@gmail.com
 wrote:
 
Hi All,
 
I have a very weird issue that I have been trying to resolve for over
 a
week now with no success in sight.
 
I use jsp to generate a page of regional information. The regions are
displayed as clickable blocks. On clicking each block a pop-up form
 opens up
with the corresponding region details like id, name and acronym.
 These can
be edited and submitted as updates. There is also a last block that
 allows
to create a new region which on clicking opens the same kind of form
 as the
others, except all the fields are blank and required.
 
I am using jquery validator plugin (bassistance) to ensure that the
 user
does not leave any field blank and I also use the form plugin to do
 an
ajaxsubmit, so that the id enterred is not a duplicate id.
 
On submitting the new region form, a new region gets created and
 updates
the page fine, but intermittently when I click on the other existing
 blocks
the information shown in the pop-up is for a completely different
 region:
for example when I click on a block labelled Washington, the popup
 that
comes up shows New York, NY, 02. On clicking New York block, the same
(correct) information is show. This does not happen always and I have
noticed it happening only in firefox, I use firefox more often also.
 Also if
I take out the ajaxsubmit and do a simple form submit, it seems to
 not
occur, but I need the ajaxsubmit for the id validation..
Interestingly, when I click on the reset button on the individual
 form, the
values in the fields correct themselves automagically for that form..
 
I also used firebug, and when I mouseover the field in the firebug
 console,
the values in the fields are shown correct (in forebug), except the
 page
displays the incorrect info. I think this safely eliminates my java
 code as
the culprit... Again - when I reset the particular form, the values
 are
good, but only for that form, so if I want to clean all such
 incorrect data,
I will have to open each form pop-up on the page and click on the
 reset
button - this would not work even as a workaround.
 
Below is the code if it helps:
 
*** JS***
$(function() {
var 

[jQuery] Re: newbie question.

2009-07-27 Thread James

No problem, Michael. Thanks for the clarification regarding an
anonymous function and a closure, and the detailed explanation for
closures. I'll give some related resources a good read on closures. :)

On Jul 27, 1:46 pm, Michael Geary m...@mg.to wrote:
 That's a great explanation, James. I hope you won't mind if I nitpick a
 point of terminology.

 The code you were talking about is not a closure:

     (function() { /* do some stuff */ })();

 As you described, the advantage of this code is that any variables you
 define inside the function won't pollute the global namespace. But that
 doesn't make it a closure. A more accurate way to describe it is an
 anonymous function expression that is called immediately.

 Here's a version of the code that doesn't use the anonymous function
 expression. It's more obvious how this works:

     function someUniqueName() {
         /* do some stuff */
     }

     someUniqueName();

 That code does the same thing, except that it also leaves someUniqueName
 defined in the global namespace (if it is a global function). As you
 explained, the first version of the code avoids that namespace pollution.
 Both versions do share the advantage that local variables inside the
 function won't go into the global namespace.

 Now, either version of the code may *create* a closure, or it may not,
 depending on what some stuff is.

 For example, this code does *not* create a closure:

     (function() {
         var text = 'hi';
         alert( text );
     })();

 Whereas this code *does* create a closure:

     (function() {
         var text = 'hi';
         setTimeout( function() {
             alert( text );
         }, 1000 );
     })();

 What's the difference? The first example has a local variable 'text' which
 is used temporarily while the function is running, but there is no need to
 preserve that variable (or anything else in the function) after the function
 returns. So as soon as the function returns, the 'text' variable is
 available for garbage collection.

 The second example also has a local variable 'text', but this variable
 *cannot* be released when the function returns. That's because the variable
 is referenced in the setTimeout() callback function, which will be called a
 full second later - long after the original function has return.

 So in this case, the 'text' variable has to be preserved for its later use
 in the setTimeout() callback.

 That's what a closure is. It's when JavaScript has to preserve a function's
 local variables (including any function arguments) after the function
 returns. If there's no need to keep those variables in existence, then
 JavaScript doesn't create a closure.

 This code creates a closure just like the last example does:

     function anotherUniqueName() {
         var text = 'hi';
         setTimeout( function() {
             alert( text );
         }, 1000 );
     }

     anotherUniqueName();

 It's not the specific form of the function call that makes it a closure or
 not, it's whether JavaScript has to preserve the function call's context
 after the function returns.

 For the gory details, here's the standard reference on JavaScript
 closures:

 http://www.jibbering.com/faq/faq_notes/closures.html

 -Mike

  From: James

  This:
  (function() { do some stuff } )();

  is known as a closure. It just runs once and it does not
  leave around any global variables (that is, if you also don't
  set any inside this function also).

  Compared to this:
  function doSomething() { // do some stuff };

  The doSomething variable will exist (globally) to be
  available for access again. It will exist in memory, and may
  possibly pollute the global namespace. This is usually a
  problem if you have a lot of other Javascript that may have
  same variable name conflicts (e.g. multiple Javascript
  libraries). In the first example, no such global variable
  will exist. It will run once, and disappear.

  In your example:
  (function($) { do some stuff } )(jQuery);

  The $ variable (local) has the value of the jQuery (global)
  variable, therefore, inside your closure, you can use $ as
  your jQuery variable.
  On Jul 25, 6:35 am, Aleksey gabb...@gmail.com wrote:
   Well, it's a common pattern that is used when creating a jQuery
   plugin.
   A common problem doing that is the use of a '$' sign, because other
   frameworks use it too as well. I didn't try to use some frameworks
   simultaneously yet, so I didn't encountered that problem by myself.
   One of the way is to use 'jQuery' instead of '$' ('$' is a
  shorthand
   of 'jQuery'), and to write, for example:

   jQuery('a').click(function() { });
   instead of
   $('a').click(function() { });

   But there is another way - this pattern allows you to use
  '$' in your
   jQuery code without the worry of malfunctioning.

   You can read more about the creating jQuery plugin in the following

  articles:http://blog.themeforest.net/tutorials/ask-jw-decoding-self-in

  

[jQuery] Slider Experts?

2009-07-27 Thread photogeek

Anyone know how to create the slider effect, coda slider, so that it
opens up with something other than the first panel/div?  I know there
is an option with serial scroll to do this, but for some reason its
not happening for me.  Thanks in advance

Andy


[jQuery] Re: Combine JQuery objects question

2009-07-27 Thread Michael Geary

Haven't you ever had the answer to a question, but not known you had the
answer? :-)

It's like the saying we had in high school:

  Freshmen know not that they know not.
  Sophomores know that they know not.
  Juniors know not that they know.
  Seniors know that they know.

-Mike
 
 From: Kean
 Why post the question if you had the answer?

  From: yuyuhua...@gmail.com
  who knows if it is possible to join two jQuery objects to 
  make a new object.  For example...
 
  var e1 = $(#firstObject);
  var e2 = $(#secondObject);
 
  var combined = e1.add(e2);  // This is the expression I'm 
 looking for



[jQuery] Re: (validate) multiple error error messages per input

2009-07-27 Thread Jules

Since you didn't post your html and code, I would guess you don't have
name property specified on your html.

input type=text id=username/input

should be

input type=text id=username name=username/input


On Jul 28, 8:26 am, jckos johncar...@gmail.com wrote:
 Hi,

 If I  focus on a field multiple times or submit the form multiple
 times, I the script adds multiple error messages per field, both valid
 and error classes, depending on the data entered.

 Any suggestions?

 Thanks,

 John


[jQuery] Re: tablesorter, sort values in anchor as numerics

2009-07-27 Thread Steven Yang
personally i do not understand anything this guy says
back to the topic

i personally will put an extra/custom attribute in a like a ref=39

then $(a) and sort on the ref attribute.

If not mistaken, there is a sorting plugin somewhere or even in jQuery core.
Or you should be able to do it easily

On Mon, Jul 27, 2009 at 9:05 PM, mila mshneyder...@gmail.com wrote:


 I am sorry, I did not understand your answer.  Do you have a solution
 to my problem?

 On Jul 26, 3:41 am, 刘永杰 liuyongjie...@gmail.com wrote:
  easyer.
 
  2009/7/25 mila mshneyder...@gmail.com
 
 
 
   I have data that looks like that
 
   a href='myURL/myapp?name=mynameparam1=val'23/a
   a href='myURL/myapp?name=hisnameparam1=val1'9/a
 
   I need it to be sorted numericaly by values between /a.  How do I
   do that?
 
 



[jQuery] Re: newbie question.

2009-07-27 Thread RobG



On Jul 28, 5:53 am, James james.gp@gmail.com wrote:
 This:
 (function() { do some stuff } )();

 is known as a closure.

You have a warped view of a closure. It is an example of the module
pattern, which can create closures, but doesn't necessarily do so.

URL: http://www.jibbering.com/faq/faq_notes/closures.html 

 It just runs once and it does not leave around
 any global variables (that is, if you also don't set any inside this
 function also).

More or less.


 Compared to this:
 function doSomething() { // do some stuff };

 The doSomething variable will exist (globally) to be available for
 access again.

There are many ways to created global variables, declaring a function
in the global scope is one.

 It will exist in memory, and may possibly pollute the
 global namespace. This is usually a problem if you have a lot of other
 Javascript that may have same variable name conflicts (e.g. multiple
 Javascript libraries). In the first example, no such global variable
 will exist. It will run once, and disappear.

Maybe. There are other methods for avoiding name collisions.


 In your example:
 (function($) { do some stuff } )(jQuery);

 The $ variable (local) has the value of the jQuery (global) variable,
 therefore, inside your closure, you can use $ as your jQuery variable.

There is no closure unless do some stuff creates one (which would
require a function declaration or expression inside the anonymous
function at least). It is the fact that $ is created as a local
variable and assigned a reference to the jQuery function that
protects it from collisions outside the function.


--
Rob


[jQuery] Re: How to deterine number of words in a string?

2009-07-27 Thread Ricardo

As ButtersRugby said, usually you'll count characters because of a
string length limit for some field or display, so you'll want to take
all punctuation and spaces into account. Counting letters only is
rarely a real requirement.

s.match(/\w/g).length makes more sense at first sight, despite being
probably slower.

-- ricardo

On Jul 27, 8:23 pm, RobG robg...@gmail.com wrote:
 On Jul 28, 5:09 am, Liam Byrne l...@onsight.ie wrote:

  A letter count is FAR easier - just get the string's length.

 The length of the string will give you a *character* count. I would
 not inlcude punctuation, white space, etc. in a *letter* count.  For
 number of letters, try:

   s.replace(/[^a-zA-Z]/g,'').length;

 --
 Rob


[jQuery] after together with load

2009-07-27 Thread avrono

Hi,

I am trying to dynamically load html into a table, i.e add new rows in
the table if a user clicks on an element in the table.

Calling code :

TDa href=# onClick=javascript:AddElement('someVal',
'someOtherval');return false;Click ME/a/TD

No problems there, I have a function :

function AddElement(someval, i) {

$('.mytable').load(http://www.someURL.com/?page=moretabletest;);

}

I have tried using the .after method (I am not sure if that is the
right terminology).

$('.mytableRow').after('trtd/td/tr);// Works !

This works fine , however I cannot figure out how to use .load()
and .after together. I.e instead of hard coded HTML to add , I want to
add HTML into my table from a GET to the server.

Any ideas ?


[jQuery] autocomplete

2009-07-27 Thread sush

Hi,
 I am using the autocomplete on local client array , and want know how
can i allow user to key in the text if autotext could not find any
results.
your help is greatly appreciated.

Thanks,
sush


[jQuery] Re: JQuery method to update one form element with value from another

2009-07-27 Thread Jules

Try the most obvious method: '(#hiddenfieldId).val(' or
'(#hiddenfieldId)[0].value =' or  '(#hiddenfieldId).get(0).value
='
assuming the hidden field is as specified below and the coder using
uniqueid.

input type=hidden id=hiddenfieldId name=hiddenfieldId /

If the code cannot be found, the original coder may use class name or
other attributes.

Good luck, modifying a 4000+ lines of code web page is a very
challenging task

On Jul 28, 7:38 am, OccasionalFlyer klit...@apu.edu wrote:
    I need to make a change to a web page that has lots of JQuery
 things in it, it appears.  Not knowing anything about the actual use
 of JQuery, however, while I will start looking at the doc, can someone
 help me with what to look for in a 4000+ line file to find out where
 the value is being set for the hidden field. I have been unable to
 identify this.  There appears to be no onChange or onSubmit JavaScript
 call. I have been given this file with the need to figure this out
 right away, with a very tight timeline to make many changes, so this
 one item can't take the time required to start learning the whole of
 JQuery before I can make a change.  Thanks.


[jQuery] Re: after together with load

2009-07-27 Thread Avron Olshewsky
Figured it out, for those interested:

$(document.createElement('tr'))
  .load('http://localhost:8080/admin/?page=moretabletest')
  .insertAfter('.c_row' + i);



On Mon, Jul 27, 2009 at 9:30 PM, avrono avronolshew...@gmail.com wrote:

 Hi,

 I am trying to dynamically load html into a table, i.e add new rows in
 the table if a user clicks on an element in the table.

 Calling code :

 TDa href=# onClick=javascript:AddElement('someVal',
 'someOtherval');return false;Click ME/a/TD

 No problems there, I have a function :

 function AddElement(someval, i) {

$('.mytable').load(http://www.someURL.com/?page=moretabletest;);

 }

 I have tried using the .after method (I am not sure if that is the
 right terminology).

$('.mytableRow').after('trtd/td/tr);// Works !

 This works fine , however I cannot figure out how to use .load()
 and .after together. I.e instead of hard coded HTML to add , I want to
 add HTML into my table from a GET to the server.

 Any ideas ?


[jQuery] Re: How to deterine number of words in a string?

2009-07-27 Thread Avron Olshewsky
Hi,

You could you the split function (assuming words are space sperated)

var mySplitResult = oXmlHttp.responseText.split( );

mySplitResult.length- Gives the array length, hence the number
of words - 1 (if I remember correctly)



On Mon, Jul 27, 2009 at 11:46 PM, Ricardo ricardob...@gmail.com wrote:


 As ButtersRugby said, usually you'll count characters because of a
 string length limit for some field or display, so you'll want to take
 all punctuation and spaces into account. Counting letters only is
 rarely a real requirement.

 s.match(/\w/g).length makes more sense at first sight, despite being
 probably slower.

 -- ricardo

 On Jul 27, 8:23 pm, RobG robg...@gmail.com wrote:
  On Jul 28, 5:09 am, Liam Byrne l...@onsight.ie wrote:
 
   A letter count is FAR easier - just get the string's length.
 
  The length of the string will give you a *character* count. I would
  not inlcude punctuation, white space, etc. in a *letter* count.  For
  number of letters, try:
 
s.replace(/[^a-zA-Z]/g,'').length;
 
  --
  Rob


[jQuery] Re: clone() + Sortable and Draggable

2009-07-27 Thread Jérôme GRAS
That's seems to be exactly what I needed.
Unfortunately, live() only works with a limited number of events, and not
with sortable.
I saw there may be a plugin that could help : livequery.
No time to investigate further for now.
See you in a few weeks !
:D

On Fri, Jul 24, 2009 at 18:27, Jérôme GRAS jeromeg...@gmail.com wrote:

 No problem for the delay, thank you for your response.
 I may be away for a while but I'll try to test and investigate as soon as
 possible.
 I will keep you updated.


 On Fri, Jul 24, 2009 at 16:16, Mean Mike mcgra...@gmail.com wrote:


 its because you need to make it live so that when new items with the
 same class show up they become sortable. I've never used live with
 sortable so you might need to investigate further but I think this
 will work

 $(.liste_champs)live(sortable, function(){
  revert: true,
  connectWith: $(.liste_champs),
  start: function(){
  $(.liste_champs).addClass('ui-state-highlight');
  },
  stop: function(){
  $(.liste_champs).removeClass('ui-state-highlight');
  },
  receive: function(){
  $(#champs).append($(#champs_caches).children().clone
 (true));
  }
  });


 btw sorry for the delay

 On Jul 17, 4:35 pm, Jérôme GRAS jeromeg...@gmail.com wrote:
  Ok, I fixed the first id bug.
  The new version is online.
 
  Unfortunately, the main problem is still present.
  I tried a lot of things unsuccessfully...
 
  Please take a look :-)
 
  On Fri, Jul 17, 2009 at 15:07, Mean Mike mcgra...@gmail.com wrote:
 
   I found a least one major problem here
 
   $(#champs).append($(#champs_caches).clone(true).removeClass(ui-
   helper-hidden));
 
your cloning div with id #champs_caches thereby creating another
   div with the same id
 
   there may be more problems than that but get that fixed then lets go
   from there
 
   Mean Mike
 
   On Jul 17, 2:58 am, rejome jeromeg...@gmail.com wrote:
Hello everyone !
 
I am facing a strange problem here :
  http://rejome.homeip.net:8080/prototype.html
 
When I clone a list that is part of a Sortable, the Draggable
 objects
are not bound to the cloned list, only the original one.
 
Do you have a solution or a hint for me please ?
 
Thanks in advance.
Réjôme.
 




[jQuery] [treeview] Menu Collapses Instantaneously with Animation

2009-07-27 Thread TH Lim

Hi,

I was trying out http://jquery.bassistance.de/treeview/demo/ Sample 2
with IE 8 in IE 7 mode. The menu animates and opens. When I click to
close, the menu collapsed instantaneously. However, it is working
perfectly in IE8 mode i.e. the menu animates while closing up. How do
I fix this for IE7?

Thanks.

/lim/