[Proto-Scripty] Re: select elements

2009-10-12 Thread david

Hi clickforward,

I do this simple test, and seems to have what expected I hope :))
here is the code:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleDraggables/title

script type=text/javascript src=prototype.js/script
script type=text/javascript src=scriptaculous.js?
load=effects,dragdrop/script

style type=text/css
  .highlight{
background-color:yellow;
  }
  .highlight2{
background-color:pink;
  }
/style

/head
body

ul id=options-10-list class=options-list
li
input id=options_10_2 class=radio type=radio value=15/
span class=label
label for=options_10_2Bodoni/label
/span
/li
li
input id=options_10_3 class=radio type=radio value=15/
span class=label
label for=options_10_3test2/label
/span
/li
li
input id=options_10_4 class=radio type=radio value=15/
span class=label
label for=options_10_4david/label
/span
/li
/ul

script type=text/javascript

$('options-10-list').select('[for=options_10_2]').each(function(e)
{
console.log(e);
 e.addClassName('highlight');

});
$('options-10-list').select('[for!=options_10_2]').each(function(e)
{
console.log(e);
 e.addClassName('highlight2');

});

/script
/body
/html

hope that help...

--
david

On 9 oct, 13:51, clicforw...@googlemail.com
clicforw...@googlemail.com wrote:
 Hi David,

 this is the code.
 I think the DOM is generated by Ajax. Maybe this couse the Prob!?
 Thanks for Help.

 ul id=options-10-list class=options-list
 li
 input id=options_10_2 class=radio type=radio value=15/
 span class=label
 label for=options_10_2Bodoni/label
 /span
 /li
 /ul

 On 9 Okt., 12:43, david david.brill...@gmail.com wrote:

  Hi clickforward,
  could you please send the HTML code with the js code, because I can't
  catch what is option-10-list, form element or list element ??

  --
  david

  On 8 oct, 19:28, speedpac...@gmail.com speedpac...@gmail.com
  wrote:

   I guess the thread I started may help you:

  http://groups.google.com/group/prototype-scriptaculous/browse_thread/...

   On Oct 8, 1:01 pm, clicforw...@googlemail.com

   clicforw...@googlemail.com wrote:
Hello anyone,

i try to select a label for=options_10_2 like this:

$('options-10-list').select('[for=options_10_2!]').each(function(e)
{
 e.addClassName('highlight');

});

or this:

$('options-10-list').down(3).each(function(e) {
 e.addClassName('highlight');

});

But its doing nothing. What wrong on this snippets?

Thanks for Help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Major frustrations with Effect.Morph

2009-10-12 Thread david

Hi Alex,
I'm sorry, I did not understand your problem.
I use it with margin and it seems to work and define all margin with
the specified length.

--
david

On 11 oct, 09:41, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 from reading the docs Effect.morph excpects a style string using camelised
 case

 I am not sure that css.padding=50px; will work as it expects a string for
 example

 {style: 'padding:50px; margin:10px;', duration: 2.0}

 HTH

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: patrick patrick99...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Sunday, October 11, 2009 4:05 AM
 Subject: [Proto-Scripty] Major frustrations with Effect.Morph

  Ok, so I can't seem to win...  It appears to me that Effect.Morph is
  full of bugs.

  I have been trying my hardest to get morph to work with padding-- and
  it doesn't behave properly...

  document.observe('dom:loaded', function() {

       $$('input.sort_children').invoke('observe', 'click', function()
  {
          var css = {};
          var children = this.next('div').immediateDescendants(); //
  this selects an array of divs

  // toggle the button state
          if (this.getValue().toLowerCase() == sort) {
             this.value = done;
             css.padding = 0px;
          }
          else {
             this.value = sort;
             css.padding = 50px;
          }

          children.each(function(e){
             new Effect.Morph(e, {style: css, duration: .5});
          });

        });
  });

  when I click my sort button, I immediately see it change to done but
  nothing happens..  I click it again.. it goes back to sort.. nothing
  happens.. I click it a 3rd time, and suddenly the padding morph
  happens.

  I then tried using css = 'classname1' and css = 'classname2'...  Then
  when I clicked it, it would set the padding to 0 properly and morph
  it... but when i'd click it a 2nd time, it would do something weird
  that look like it set the padding to 5 and then it dropped down to 0
  again...

  ...  I also was trying to set the display properties from 'inline-
  block' to 'block'.. and that did not work at all either when I was
  using my css = {} hash/object...  When I tried using it with
  classnames, similarly to padding, it only seemed to partially work.

  Then I changed my css = {} hash/object to just deal with borders:

          if (this.getValue().toLowerCase() == sort) {
             this.value = done;
             css.border = 1px solid red;
          }
          else {
             this.value = sort;
             css.border = 5px dotted blue;
          }

  ... this works fine.. so, it appears that Morph can't handle certain
  css properties.

  .. Oh and of course, if I change my:

  children.each(function(e){
             new Effect.Morph(e, {style: css, duration: .5});
          });

  to:

  children.invoke('setStyle', css);

  then all of my changes are exactly as they should be-- but I really
  wanted to have some animation.

  -patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Focus and Blur in IE / Webkit

2009-10-12 Thread david

Hi Alex,
I perhaps did not understand what is your trouble, but interrest in
the solution you achieve, and perhaps some idea could come ...

--
david

On 9 oct, 13:46, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 I suppose what i am asking for is a prototype cross browser way of detecting
 what element was clicked when a blur event occurs ...

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Alex McAuley webmas...@thecarmarketplace.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Friday, October 09, 2009 12:44 PM
 Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit

  I think i have a way to do it but it involves watching the whole document
  for a click which i didnt really want to do.

  Alex Mcauley
 http://www.thevacancymarket.com

  - Original Message -
  From: david david.brill...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, October 09, 2009 12:33 PM
  Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit

  alex,

  I was saying a mix of both evens.
  For functionnality that work, just use focus/blur, and for the one
  that don't work, help it with mouseover / out ?

  Or I peerhaps miss something?
  A live example ??

  --
  david

  On 9 oct, 13:21, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
  Hi David.

  It promotes the same problem though .. If i listen for
  mouseover/mouseout
  on
  the element once the mouse goes out of it then it will hide the results
  element anyway!..

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: david david.brill...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, October 09, 2009 12:18 PM
  Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit

   Hi alex,

   If I have understand, you could mix the focus/blur with a mouseover/
   mouseout even, because when you receive focus, and scroll, you are
   during a mouseover, and when not over, northing has to be done.
   Or somethink like that ?

   Does it gives you idea ?

   --
   david

   On 9 oct, 12:58, Alex Mcauley webmas...@thecarmarketplace.com wrote:
   Morning people.

   Got a slight issue with IE and focus / blur.

   I have a suggestive searchbox that observes keyup and does its
   thing... This all works fine.

   There is a height with overflow:auto on it to allow users to scroll
   through multiple results to find the correct result and be able to
   select it.

   I have just added a(n) observer for focus / blur of the input element
   that hides the results element on blur and shows them on re-focus of
   the element.

   This all works fine in firefox but does not work in webkit/IE.. It
   works as much as blurring and focusing does hide the element but if i
   try to scroll down the Results element it sees the focus is lost
   and
   hides it!..

   What i am trying to replicate is to see what is being focussed /
   pressed when this is occuring and if its the Results element then
   to
   not show or hide the Results element.

   Hope i explained that well and i am sure someone has come across this
   before.

   All relevant help appreciated

   Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Major frustrations with Effect.Morph

2009-10-12 Thread david

Sorry Alex, did not see next thread with the same name, it seems to be
the following of it.

--
david

On 12 oct, 11:25, david david.brill...@gmail.com wrote:
 Hi Alex,
 I'm sorry, I did not understand your problem.
 I use it with margin and it seems to work and define all margin with
 the specified length.

 --
 david

 On 11 oct, 09:41, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

  from reading the docs Effect.morph excpects a style string using camelised
  case

  I am not sure that css.padding=50px; will work as it expects a string for
  example

  {style: 'padding:50px; margin:10px;', duration: 2.0}

  HTH

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: patrick patrick99...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
  Sent: Sunday, October 11, 2009 4:05 AM
  Subject: [Proto-Scripty] Major frustrations with Effect.Morph

   Ok, so I can't seem to win...  It appears to me that Effect.Morph is
   full of bugs.

   I have been trying my hardest to get morph to work with padding-- and
   it doesn't behave properly...

   document.observe('dom:loaded', function() {

        $$('input.sort_children').invoke('observe', 'click', function()
   {
           var css = {};
           var children = this.next('div').immediateDescendants(); //
   this selects an array of divs

   // toggle the button state
           if (this.getValue().toLowerCase() == sort) {
              this.value = done;
              css.padding = 0px;
           }
           else {
              this.value = sort;
              css.padding = 50px;
           }

           children.each(function(e){
              new Effect.Morph(e, {style: css, duration: .5});
           });

         });
   });

   when I click my sort button, I immediately see it change to done but
   nothing happens..  I click it again.. it goes back to sort.. nothing
   happens.. I click it a 3rd time, and suddenly the padding morph
   happens.

   I then tried using css = 'classname1' and css = 'classname2'...  Then
   when I clicked it, it would set the padding to 0 properly and morph
   it... but when i'd click it a 2nd time, it would do something weird
   that look like it set the padding to 5 and then it dropped down to 0
   again...

   ...  I also was trying to set the display properties from 'inline-
   block' to 'block'.. and that did not work at all either when I was
   using my css = {} hash/object...  When I tried using it with
   classnames, similarly to padding, it only seemed to partially work.

   Then I changed my css = {} hash/object to just deal with borders:

           if (this.getValue().toLowerCase() == sort) {
              this.value = done;
              css.border = 1px solid red;
           }
           else {
              this.value = sort;
              css.border = 5px dotted blue;
           }

   ... this works fine.. so, it appears that Morph can't handle certain
   css properties.

   .. Oh and of course, if I change my:

   children.each(function(e){
              new Effect.Morph(e, {style: css, duration: .5});
           });

   to:

   children.invoke('setStyle', css);

   then all of my changes are exactly as they should be-- but I really
   wanted to have some animation.

   -patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Focus and Blur in IE / Webkit

2009-10-12 Thread Alex McAuley
Thanks Mona much appreciated.



Alex Mcauley

http://www.thevacancymarket.com
  - Original Message - 
  From: Mona Remlawi 
  To: prototype-scriptaculous@googlegroups.com 
  Sent: Monday, October 12, 2009 12:27 PM
  Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit


  Hello  Alex, 

  I had a similar problem with my custom autocompleter. So to workaround a 
solution, I leveraged the mouseenter and mouseleave events over the suggestion 
box to detach/re-attach blur handler over search_input.

  Something like:

  search_input.observe('focus', showSuggestionBox);
  search_input.observe('blur',   hideSuggestionBox);

  suggestion_box.observe('mouseenter', function() 
{search_input.stopObserving('blur', hideSugggestionBox)});
  suggestion_box.observe('mouseleave', function() {search_input.observe('blur', 
hideSugggestionBox)});

  HTH

  --
  mona


  On Mon, Oct 12, 2009 at 11:34 AM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


I couldnt find a reasonable solution so i just went with somehting else
!!...

I will continue to look for one though !

Thanks


Alex Mcauley
http://www.thevacancymarket.com
- Original Message -

From: david david.brill...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com

Sent: Monday, October 12, 2009 10:28 AM
Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit



 Hi Alex,
 I perhaps did not understand what is your trouble, but interrest in
 the solution you achieve, and perhaps some idea could come ...

 --
 david

 On 9 oct, 13:46, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
 I suppose what i am asking for is a prototype cross browser way of
 detecting
 what element was clicked when a blur event occurs ...

 Alex Mcauleyhttp://www.thevacancymarket.com

 - Original Message -
 From: Alex McAuley webmas...@thecarmarketplace.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Friday, October 09, 2009 12:44 PM
 Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit

  I think i have a way to do it but it involves watching the whole
  document
  for a click which i didnt really want to do.

  Alex Mcauley
 http://www.thevacancymarket.com

  - Original Message -
  From: david david.brill...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, October 09, 2009 12:33 PM
  Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit

  alex,

  I was saying a mix of both evens.
  For functionnality that work, just use focus/blur, and for the one
  that don't work, help it with mouseover / out ?

  Or I peerhaps miss something?
  A live example ??

  --
  david

  On 9 oct, 13:21, Alex McAuley webmas...@thecarmarketplace.com
  wrote:
  Hi David.

  It promotes the same problem though .. If i listen for
  mouseover/mouseout
  on
  the element once the mouse goes out of it then it will hide the
  results
  element anyway!..

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: david david.brill...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Friday, October 09, 2009 12:18 PM
  Subject: [Proto-Scripty] Re: Focus and Blur in IE / Webkit

   Hi alex,

   If I have understand, you could mix the focus/blur with a
   mouseover/
   mouseout even, because when you receive focus, and scroll, you are
   during a mouseover, and when not over, northing has to be done.
   Or somethink like that ?

   Does it gives you idea ?

   --
   david

   On 9 oct, 12:58, Alex Mcauley webmas...@thecarmarketplace.com
   wrote:
   Morning people.

   Got a slight issue with IE and focus / blur.

   I have a suggestive searchbox that observes keyup and does its
   thing... This all works fine.

   There is a height with overflow:auto on it to allow users to
   scroll
   through multiple results to find the correct result and be able to
   select it.

   I have just added a(n) observer for focus / blur of the input
   element
   that hides the results element on blur and shows them on re-focus
   of
   the element.

   This all works fine in firefox but does not work in webkit/IE.. It
   works as much as blurring and focusing does hide the element but
   if i
   try to scroll down the Results element it sees the focus is lost
   and
   hides it!..

   What i am trying to replicate is to see what is being focussed /
   pressed when this is occuring and if its the Results element
   then
   to
   not 

[Proto-Scripty] Re: IE Add Observers in Reverse Order?

2009-10-12 Thread ColinFine



On Sep 29, 12:22 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 There is no order guarantee in either case (MDC doesn't discuss order
 [1], MSDN specifically says it's random[2]).

And the W3C spec [1] specifically says it is left up to them:
Many single modifications of the tree can cause multiple mutation
events to be fired. Rather than attempt to specify the ordering of
mutation events due to every possible modification of the tree, the
ordering of these events is left to the implementation.

[1] 
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-mutationevents

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Autocompleter requst on hitting space character

2009-10-12 Thread Yogesh

Hello,

I am using Ajax.autocompleter on a text input search field. What I
want to have it after a user hits a space character, my php script
should return 30 most recent  results. I have written the query on php
side for this. I have set minchars=0 in autocompleter options.

I checked from firebug's responses that when I hit the space key, my
page is not making the request to my server side page.

My question is how do I trigger a request on space key?

Following is my code:

script type=text/javascript
new Ajax.Autocompleter(search,hint,server_class_nonew.php,
{
   afterUpdateElement : 
getSelectedId,
   minChars:0 ,
   frequency:0.4,
   paramName: value
}
   );

function getSelectedId(text, li) {
$('class_id').value=li.id;
document.forms['searchcustomerform'].submit();
}
/script

Thanks you.

Sincerely,
Yogesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: how to select all elements by class after a certain point?

2009-10-12 Thread Matt Foster

 var nextElements=$(element).descendants();// returns everythign that

This would return all children of the element, not siblings.

On Oct 10, 4:26 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 If you use Event with element you can find the element that was clicked

 $$('.blah').each(function(e) {
    $(e).observe('click',function(event){
    var element=Event.element(event); // this is the element
         var nextElements=$(element).descendants();// returns everythign that
 is a

   });

 });

 This is untested. Your list is a straight list of divs so it may not work -
 but try it and see!..

 HTH

 Alex Mcauley

 http://www.thevacancymarket.com

 - Original Message -
 From: patrick patrick99...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Saturday, October 10, 2009 8:41 AM
 Subject: [Proto-Scripty] how to select all elements by class after a certain

 point?

  Hi everyone,

  I am a bit stuck on this..  So, I have a layout with something like
  this:

  div class=blahblah/div
  div class=blahblah/div
  div class=other_class/div
  div class=blahblah/div
  div class=blahblah/div
  div class=blahblah/div
  div class=other_class/div
  div class=blahblah/div

  ...  I have a function that is called when one of my '.blah' divs is
  clicked, and so in that function  'this' refers the particular div..
  I am trying to figure out how I can get all of the divs that are
  '.blah' after 'this'...

  Thank you.

  -patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Submit form on select for autosuggest

2009-10-12 Thread Matt Foster

You've defined your function after you reference it...

It needs to be created first then it can be referenced.

function getSelectedId(text, li) {
$('class_id').value=li.id;
document.forms['searchcustomerform'].submit();
}

new Ajax.Autocompleter(search,hint,server_class.php,
{afterUpdateElement : getSelectedId, minChars:1});

--

http://positionabsolute.net


On Oct 8, 10:45 pm, Yogesh Agashe yogesh.aga...@gmail.com wrote:
 Hello,
 Thanks for the reply. I tried doing that but it didn't work for me.If you 
 point out the mistake in following code, it will be great.Thanks 
 again.script type=text/javascript     new 
 Ajax.Autocompleter(search,hint,server_class.php, {afterUpdateElement : 
 getSelectedId, minChars:1});         function getSelectedId(text, li) {       
       $('class_id').value=li.id;             
 document.forms['searchcustomerform'].submit();         } /scriptThanks,
 Yogesh
 Matt Foster 
 wrote:http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleterafterUpdateElement
  function... you receive an input object and some element that was 
 representing the field. At this point you could execute form.submit.. 
 --http://positionabsolute.netOn Oct 7, 11:19 am, 
 Yogeshyogesh.aga...@gmail.comwrote:Hello, I am using Ajax.autocompleter in 
 one of my forms. I am calling a custom function getSelectedId after update 
 element to get an ID of the selected list item. I need a functionality such 
 that form should get submitted whenever : 1) a user clicks a item using mouse 
 from the autosuggest list. 2) Whenever user presses enter key while a list 
 item is selected. (This I have achieved through a hack as shown in code 
 below. I call .submit() after getSelectedId function) I don't know how to 
 submit the form on mouse click. Any help on this issue will be really helpful 
 to me. script type=text/javascript     new 
 Ajax.Autocompleter(search,hint,server_class.php, {afterUpdateElement : 
 getSelectedId, minChars:1});         function getSelectedId(text, li) {       
       $('class_id').value=li.id;             
 document.forms['searchcustomerform'].submit();         } /script Thank you. 
 Sincerely, Yogesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Submit form on select for autosuggest

2009-10-12 Thread Yogesh Agashe





Thanks for pointing out this error Matt. I should have noticed this. 

But even after defining the function earlier, form submit doesn't work
:(

Sorry.

Sincerely,
Yogesh

Matt Foster wrote:

  You've defined your function after you reference it...

It needs to be created first then it can be referenced.

function getSelectedId(text, li) {
$('class_id').value=li.id;
document.forms['searchcustomerform'].submit();
}

new Ajax.Autocompleter("search","hint","server_class.php",
{afterUpdateElement : getSelectedId, minChars:1});

--

http://positionabsolute.net


On Oct 8, 10:45pm, Yogesh Agashe yogesh.aga...@gmail.com wrote:
  
  
Hello,
Thanks for the reply. I tried doing that but it didn't work for me.If you point out the mistake in following code, it will be great.Thanks again.script type="text/_javascript_"   new Ajax.Autocompleter("search","hint","server_class.php", {afterUpdateElement : getSelectedId, minChars:1}); function getSelectedId(text, li) {   $('class_id').value=li.id;   document.forms['searchcustomerform'].submit(); } /scriptThanks,
Yogesh
Matt Foster wrote:http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleterafterUpdateElement function... you receive an input object and some element that was representing the field. At this point you could execute form.submit.. --http://positionabsolute.netOn Oct 7, 11:19am, Yogeshyogesh.aga...@gmail.comwrote:Hello, I am using Ajax.autocompleter in one of my forms. I am calling a custom function getSelectedId after update element to get an ID of the selected list item. I need a functionality such that form should get submitted whenever : 1) a user clicks a item using mouse from the autosuggest list. 2) Whenever user presses enter key while a list item is selected. (This I have achieved through a hack as shown in code below. I call .submit() after getSele
ctedId function) I don't know how to submit the form on mouse click. Any help on this issue will be really helpful to me. script type="text/_javascript_"   new Ajax.Autocompleter("search","hint","server_class.php", {afterUpdateElement : getSelectedId, minChars:1}); function getSelectedId(text, li) {   $('class_id').value=li.id;   document.forms['searchcustomerform'].submit(); } /script Thank you. Sincerely, Yogesh

  
  
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Prototype  script.aculo.us group.  To post to this group, send email to prototype-scriptaculous@googlegroups.com  To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com  For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---





[Proto-Scripty] Re: Submit form on select for autosuggest

2009-10-12 Thread Yogesh Agashe





Hello,

I am glad to say that I found the root of the problem. I had a button
named submit and this was causing the problem. 

Thanks so much Matt for pointing out the function definition error. 

As Christo notes here: (http://www.spiration.co.uk/post/1232/Submit%20is%20not%20a%20function)

This means you have a function trying to call the form's submit()
method, but you also have a button which is called submit(). This
causes a conflict in _javascript_, because the submit method is already
bound to that button. 

To solve the problem, simply change the name of the button so that
name="moo" (or something). Your submit() call in your _javascript_
function/method will now work.

Sincerely,
Yogesh





Yogesh Agashe wrote:

  
Thanks for pointing out this error Matt. I should have noticed this. 
  
But even after defining the function earlier, form submit doesn't work
:(
  
Sorry.
  
Sincerely,
Yogesh
  
Matt Foster wrote:
  
You've defined your function after you reference it...

It needs to be created first then it can be referenced.

function getSelectedId(text, li) {
$('class_id').value=li.id;
document.forms['searchcustomerform'].submit();
}

new Ajax.Autocompleter("search","hint","server_class.php",
{afterUpdateElement : getSelectedId, minChars:1});

--

http://positionabsolute.net


On Oct 8, 10:45pm, Yogesh Agashe yogesh.aga...@gmail.com wrote:
  

  Hello,
Thanks for the reply. I tried doing that but it didn't work for me.If you point out the mistake in following code, it will be great.Thanks again.script type="text/_javascript_"   new Ajax.Autocompleter("search","hint","server_class.php", {afterUpdateElement : getSelectedId, minChars:1}); function getSelectedId(text, li) {   $('class_id').value=li.id;   document.forms['searchcustomerform'].submit(); } /scriptThanks,
Yogesh
Matt Foster wrote:http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleterafterUpdateElement function... you receive an input object and some element that was representing the field. At this point you could execute form.submit.. --http://positionabsolute.netOn Oct 7, 11:19am, Yogeshyogesh.aga...@gmail.comwrote:Hello, I am using Ajax.autocompleter in one of my forms. I am calling a custom function getSelectedId after update element to get an ID of the selected list item. I need a functionality such that form should get submitted whenever : 1) a user clicks a item using mouse from the autosuggest list. 2) Whenever user presses enter key while a list item is selected. (This I have achieved through a hack as shown in code below. I call .submit() after getSele
ctedId function) I don't know how to submit the form on mouse click. Any help on this issue will be really helpful to me. script type="text/_javascript_"   new Ajax.Autocompleter("search","hint","server_class.php", {afterUpdateElement : getSelectedId, minChars:1}); function getSelectedId(text, li) {   $('class_id').value=li.id;   document.forms['searchcustomerform'].submit(); } /script Thank you. Sincerely, Yogesh



  
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Prototype  script.aculo.us group.  To post to this group, send email to prototype-scriptaculous@googlegroups.com  To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com  For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---





[Proto-Scripty] Re: how to select all elements by class after a certain point?

2009-10-12 Thread Alex McAuley

Hence the note on it This might not work as its divs.

Alex Mcauley

http://www.thevacancymarket.com

- Original Message - 
From: Matt Foster mattfoste...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Monday, October 12, 2009 7:12 PM
Subject: [Proto-Scripty] Re: how to select all elements by class after a 
certain point?



 var nextElements=$(element).descendants();// returns everythign 
 that

This would return all children of the element, not siblings.

On Oct 10, 4:26 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 If you use Event with element you can find the element that was clicked

 $$('.blah').each(function(e) {
 $(e).observe('click',function(event){
 var element=Event.element(event); // this is the element
 var nextElements=$(element).descendants();// returns everythign that
 is a

 });

 });

 This is untested. Your list is a straight list of divs so it may not 
 work -
 but try it and see!..

 HTH

 Alex Mcauley

 http://www.thevacancymarket.com

 - Original Message -
 From: patrick patrick99...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Saturday, October 10, 2009 8:41 AM
 Subject: [Proto-Scripty] how to select all elements by class after a 
 certain

 point?

  Hi everyone,

  I am a bit stuck on this.. So, I have a layout with something like
  this:

  div class=blahblah/div
  div class=blahblah/div
  div class=other_class/div
  div class=blahblah/div
  div class=blahblah/div
  div class=blahblah/div
  div class=other_class/div
  div class=blahblah/div

  ... I have a function that is called when one of my '.blah' divs is
  clicked, and so in that function 'this' refers the particular div..
  I am trying to figure out how I can get all of the divs that are
  '.blah' after 'this'...

  Thank you.

  -patrick



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: how to select all elements by class after a certain point?

2009-10-12 Thread Matt Foster

 Hence the note on it This might not work as its divs.
The name of the elements have no weight on the issue.  The structure
of the elements are all that matters.

Siblings != Children

You should have added the disclaimer... This does not work...



On Oct 12, 3:04 pm, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Hence the note on it This might not work as its divs.

 Alex Mcauley

 http://www.thevacancymarket.com

 - Original Message -
 From: Matt Foster mattfoste...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Monday, October 12, 2009 7:12 PM
 Subject: [Proto-Scripty] Re: how to select all elements by class after a

 certain point?

          var nextElements=$(element).descendants();// returns everythign
  that

 This would return all children of the element, not siblings.

 On Oct 10, 4:26 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  If you use Event with element you can find the element that was clicked

  $$('.blah').each(function(e) {
  $(e).observe('click',function(event){
  var element=Event.element(event); // this is the element
  var nextElements=$(element).descendants();// returns everythign that
  is a

  });

  });

  This is untested. Your list is a straight list of divs so it may not
  work -
  but try it and see!..

  HTH

  Alex Mcauley

 http://www.thevacancymarket.com

  - Original Message -
  From: patrick patrick99...@gmail.com
  To: Prototype  script.aculo.us
  prototype-scriptaculous@googlegroups.com
  Sent: Saturday, October 10, 2009 8:41 AM
  Subject: [Proto-Scripty] how to select all elements by class after a
  certain

  point?

   Hi everyone,

   I am a bit stuck on this.. So, I have a layout with something like
   this:

   div class=blahblah/div
   div class=blahblah/div
   div class=other_class/div
   div class=blahblah/div
   div class=blahblah/div
   div class=blahblah/div
   div class=other_class/div
   div class=blahblah/div

   ... I have a function that is called when one of my '.blah' divs is
   clicked, and so in that function 'this' refers the particular div..
   I am trying to figure out how I can get all of the divs that are
   '.blah' after 'this'...

   Thank you.

   -patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Submit form on select for autosuggest

2009-10-12 Thread Matt Foster

Hey Yogesh,

  You may want to also look at how you're referencing the
form.  Usually document.forms is a numerical array, not an
associative.  I'd recommend using an ID on the form object and then
grab it
 via $(form_id)...

document.forms['searchcustomerform'].submit();
vs
$(searchcustomerform).submit();

Cheers,
  Matt

On Oct 12, 3:02 pm, Yogesh Agashe yogesh.aga...@gmail.com wrote:
 Hello,
 I am glad to say that I found the root of the problem. I had a button named 
 submit and this was causing the problem.
 Thanks so much Matt for pointing out the function definition error.
 As Christo notes here: 
 (http://www.spiration.co.uk/post/1232/Submit%20is%20not%20a%20function)
 This means you have a function trying to call the form's submit() method, but 
 you also have a button which is called submit(). This causes a conflict in 
 javascript, because the submit method is already bound to that button.
 To solve the problem, simply change the name of the button so that name=moo 
 (or something). Your submit() call in your javascript function/method will 
 now work.
 Sincerely,
 Yogesh
 Yogesh Agashe wrote:Thanks for pointing out this error Matt. I should have 
 noticed this.
 But even after defining the function earlier, form submit doesn't work :(
 Sorry.
 Sincerely,
 Yogesh
 Matt Foster wrote:You've defined your function after you reference it... It 
 needs to be created first then it can be referenced. function 
 getSelectedId(text, li) { $('class_id').value=li.id; 
 document.forms['searchcustomerform'].submit(); } new 
 Ajax.Autocompleter(search,hint,server_class.php, {afterUpdateElement : 
 getSelectedId, minChars:1}); --http://positionabsolute.netOn Oct 8, 10:45 pm, 
 Yogesh Agasheyogesh.aga...@gmail.comwrote:Hello, Thanks for the reply. I 
 tried doing that but it didn't work for me.If you point out the mistake in 
 following code, it will be great.Thanks again.script type=text/javascript 
     new Ajax.Autocompleter(search,hint,server_class.php, 
 {afterUpdateElement : getSelectedId, minChars:1});         function 
 getSelectedId(text, li) {             $('class_id').value=li.id;             
 document.forms['searchcustomerform'].submit();         } /scriptThanks, 
 Yogesh Matt Foster 
 wrote:http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleterafterUpdateElementfunction...
  you receive an input object and some element that was representing the 
 field. At this point you could execute form.submit.. 
 --http://positionabsolute.netOn Oct 7, 11:19 am, 
 Yogeshyogesh.aga...@gmail.comwrote:Hello, I am using Ajax.autocompleter in 
 one of my forms. I am calling a custom function getSelectedId after update 
 element to get an ID of the selected list item. I need a functionality such 
 that form should get submitted whenever : 1) a user clicks a item using mouse 
 from the autosuggest list. 2) Whenever user presses enter key while a list 
 item is selected. (This I have achieved through a hack as shown in code 
 below. I call .submit() after getSele ctedId function) I don't know how to 
 submit the form on mouse click. Any help on this issue will be really helpful 
 to me. script type=text/javascript     new 
 Ajax.Autocompleter(search,hint,server_class.php, {afterUpdateElement : 
 getSelectedId, minChars:1});         function getSelectedId(text, li) {       
       $('class_id').value=li.id;             
 document.forms['searchcustomerform'].submit();         } /script Thank you. 
 Sincerely, Yogesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] element.down() invalid string

2009-10-12 Thread JoJo

Why is it that the following gives the error: [Exception... An
invalid or illegal string was specified code: 12]

   var title = $(channelId).down('strong').down('a').innerHTML;

While this one, which looks identical to me work just fine?

   var title = $$('#' + channelId + ' strong a').first().innerHTML;
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---