[jQuery] jquery unchecking checkbox?

2009-07-16 Thread eimantas

Hi all

I'm implementing the standard select all/none functionality for table
rows and got this problem that i can't overcome. I use this code
snippet to do selection:

  $(selAll, tableSelector).toggle(
function(e) {
  $('input[type=checkbox]', tableSelector).attr('checked',
'checked');
},
function() {
  $('input[type=checkbox]', tableSelector).removeAttr('checked');
}
  );

selAll is selector for checkbox that should select all/none checkboxes
in table, tableSelector is... well... table selector. However i
noticed that each time i click on selAll checkbox, it stays unchecked.
Debugging on Firefox (using Firebug's debugger) shows that unchecking
gets executed after the first toggle function is left (the checkbox
gets checkedbefore the only line of code in that function).

Any pointers are much appreciated!


[jQuery] Re: Detecting a redirect response to an Ajax query

2009-07-17 Thread eimantas

another solution would be to launch a client-side javascript timeout
function that redirects user to login/signup page after session
validity time has passed (say, 15 minutes). this way user wouldn't
need to be redirected after clicking a link.

in one site i saw a similar solution:
- user opens a page and does nothing (nor with mouse or keyboard).
- a minute untill the session expires, user is presented with dialog
box that says something like "do something or you'll be logged out in
60 {and counting} seconds".
- if user moves a mouse or presses a key - the dialog disappears and
session is continued (some sort of "ping" is done via ajax to notify
server side of user's activity)
- if user is absent (i.e. no activity is detected in 60 minutes) user
gets redirected to login/singup page.


[jQuery] (validate)

2009-12-16 Thread eimantas
Hi guys

I'm having trouble with validation plugin from bassistance.de. I have
custom handlers for errorPlacement, highlight and unhighlight events.
I also have defined custom errorElement. Error messages and validation
data is extracted via metadata plugin using html5 data-* attributes.

The problem is that if I define custom errorClass (which i need for
error message elements), the error gets added each time the field is
unfocused and left blank after first validation. For example:

1) I open form and try to submit it;
2) Errors are displayed;
3) I focus/blur errored field;
4) the error for that field is added again;

Any help would be appreciated without disclosing lots of mine code .)

Thank you in advance for taking time to answer my call for help!


[jQuery] Re: (validate)

2009-12-17 Thread eimantas
Here how it looks now:

validator : $('#new_place').validate({
  errorElement: 'p',
  errorPlacement: function(error, elem) {
error.addClass('error-message left');
if (elem.attr('id') != 'select_id') {
  elem.parent('span').after(error);
} else {
  elem.parents('div.line.categories').append(error);
};
  },
  meta: 'validate',
  debug: true,
  onsubmit: false,
  highlight: function(element, errorClass) {
if ($(element).attr('id') != 'select_id') {
  $(element).parents('div.field-wrapper').addClass('errors');
  if ($(element).parent('span').next().length > 0) {
$(element).parent('span').next('p.error').addClass('error-
message left');
  };
} else {
  $(element).parents('div.line.categories').prev
('div.line').addClass('errors'); // red label
  $(element).parents('div.line.categories').addClass
('errors'); // red error
};
  },
  unhighlight: function(element, errorClass) {
if ($(element).attr('id') != 'select_id') {
  $(element).parents('div.field-wrapper').removeClass
('errors');
} else {
  $(element).parents('div.line').removeClass('errors');
  $(element).parents('div.line').prev
('div.line.errors').removeClass('errors');
};
  }
}),

and as soon as i add errorClass: 'error-message left' to the validator
configuration - messages start piling up.

On Dec 16, 6:29 pm, Jörn Zaefferer 
wrote:
> Without seeing any of your code is pure guesswork to help you find the
> issue. I need to see at least the code configuring the validation plugin.
>
> Jörn
>
> 2009/12/16 eimantas 
>
> > Hi guys
>
> > I'm having trouble with validation plugin from bassistance.de. I have
> > custom handlers for errorPlacement, highlight and unhighlight events.
> > I also have defined custom errorElement. Error messages and validation
> > data is extracted via metadata plugin using html5 data-* attributes.
>
> > The problem is that if I define custom errorClass (which i need for
> > error message elements), the error gets added each time the field is
> > unfocused and left blank after first validation. For example:
>
> > 1) I open form and try to submit it;
> > 2) Errors are displayed;
> > 3) I focus/blur errored field;
> > 4) the error for that field is added again;
>
> > Any help would be appreciated without disclosing lots of mine code .)
>
> > Thank you in advance for taking time to answer my call for help!