[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-11 Thread buda

:) my  thoughts so fast that I havnt a time to type them correctly :))

On 7 окт, 17:02, Walter Lee Davis [EMAIL PROTECTED] wrote:
 Your grammar halo is shining!

 Walter

 On Oct 6, 2008, at 10:30 PM, Justin Perkins wrote:



  p.s. look I did not use 'your' improperly once! ;)- Скрыть цитируемый текст 
  -

 - Показать цитируемый текст -
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread buda

it gets all elements for a form? but I need for a div!

On 7 окт, 03:13, Justin Perkins [EMAIL PROTECTED] wrote:
 Have you looked into the Form helper methods such as Form#getElements?

 http://prototypejs.org/api/form/getElements

 -justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread buda

it is - but on a form it may be several divs filled with input
elements and I have to work with them separetely from other divs and I
need to have their right ordered array of input elements

On 7 окт, 04:35, Justin Perkins [EMAIL PROTECTED] wrote:
 2008/10/6 buda [EMAIL PROTECTED]:

  it gets all elements for a form? but I need for a div!

 Usually wherever *form* elements (input, select, textarea) exist, a
 form tag will be around them.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread Justin Perkins

2008/10/6 buda [EMAIL PROTECTED]:

 it is - but on a form it may be several divs filled with input
 elements and I have to work with them separetely from other divs and I
 need to have their right ordered array of input elements

You're right, sorry I did not think of that. Rob's idea is a good one.
You could also still use the Form#getElements method then filter out
those that are not in the div your interested in. What route your
choose should dependent on your markup mostly (lots of form controls
vs. lots of div child elements).

-justin

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread buda

Thanks for idea, there is no any way by doing it with prototype.js
nativly?

On 7 окт, 05:14, RobG [EMAIL PROTECTED] wrote:
 On Oct 7, 10:08 am, buda [EMAIL PROTECTED] wrote:

  How can I get elements [select-one, input-text, input-checkbox, input-
  radio, textarea] which are placed in a div in order of their position
  in it?

 use div.getElementsByTagName('*') to get all the div's decendents in
 DOM order. Iterate over them to filter out the non-form controls (say
 convert to an array and use each).

 --
 Rob
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread RobG



On Oct 7, 12:22 pm, buda [EMAIL PROTECTED] wrote:
 Thanks for idea, there is no any way by doing it with prototype.js
 nativly?

Sure, use $A to convert the returned NodeList to an array and use each
to iterate over it.  As far as I know, Prototype.js doesn't wrap
getElementsByTagName - what would be the point?

An alternative is to get all the form's controls (form.elements) and
iterate over those to find which have the div as a ancestor.

Depending on the distribution of other elements in the div, that may
be faster but perhaps not noticeably so.  You can optimise performance
by stopping the filter as soon as you stop getting form controls that
have div as an ancestor.


--
Rob
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread buda

Thanks a lot for the idea with ancestor - I have resolve the problem

On 7 окт, 05:34, RobG [EMAIL PROTECTED] wrote:
 On Oct 7, 12:22 pm, buda [EMAIL PROTECTED] wrote:

  Thanks for idea, there is no any way by doing it with prototype.js
  nativly?

 Sure, use $A to convert the returned NodeList to an array and use each
 to iterate over it.  As far as I know, Prototype.js doesn't wrap
 getElementsByTagName - what would be the point?

 An alternative is to get all the form's controls (form.elements) and
 iterate over those to find which have the div as a ancestor.

 Depending on the distribution of other elements in the div, that may
 be faster but perhaps not noticeably so.  You can optimise performance
 by stopping the filter as soon as you stop getting form controls that
 have div as an ancestor.

 --
 Rob
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread buda

The question is how to chek if the control has the div as a ancestor
(controls often positioned in different elements ro make UI)

On 7 окт, 05:34, RobG [EMAIL PROTECTED] wrote:
 On Oct 7, 12:22 pm, buda [EMAIL PROTECTED] wrote:

  Thanks for idea, there is no any way by doing it with prototype.js
  nativly?

 Sure, use $A to convert the returned NodeList to an array and use each
 to iterate over it.  As far as I know, Prototype.js doesn't wrap
 getElementsByTagName - what would be the point?

 An alternative is to get all the form's controls (form.elements) and
 iterate over those to find which have the div as a ancestor.

 Depending on the distribution of other elements in the div, that may
 be faster but perhaps not noticeably so.  You can optimise performance
 by stopping the filter as soon as you stop getting form controls that
 have div as an ancestor.

 --
 Rob
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread Justin Perkins

2008/10/6 buda [EMAIL PROTECTED]:
 it gets all elements for a form? but I need for a div!

Usually wherever *form* elements (input, select, textarea) exist, a
form tag will be around them.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---