ok, h.update is correct if you want to send it multiple values at
once, if you do not know exactly how many items you will be adding at
once until runtime, you'd have to loop anyway to build the object to
send to h.update.
In that case just loop over them once and add to the hash
Something like:
$$('#contents').each(function(s) { h.set(s.identify(), s.getValue() ) });
On Tue, Aug 25, 2009 at 5:09 PM, buda <[email protected]> wrote:
>
> I need to put into hash pairs:
>
> input1.id : input1.getValue
> ....
> inputN.id : inputN.getValue
>
> where N may be from 5 to 25
>
>
> On 26 авг, 02:46, DJ Mangus <[email protected]> wrote:
> > gah, just looked at the source, I was wrong about that, ignore the last
> > message I sent.
> >
> >
> >
> > On Tue, Aug 25, 2009 at 4:41 PM, DJ Mangus <[email protected]> wrote:
> > > if you feed set() an object it should set multiple key/value pairs at
> > > once.
> >
> > > On Tue, Aug 25, 2009 at 4:32 PM, Kevin Porter <[email protected]>
> > > wrote:
> >
> > >> What do you mean by 'some pairs'?
> >
> > >> Looks like set() is what you want.
> >
> > >> What do you want your hash to look like before and after?
> >
> > >> - Kev
> >
> > >> buda wrote:
> > >> > Sorry for not full description of my task - I need to add some pairs
> > >> > to a hash - so set() doesnt hepl me :(
> >
> > >> > On 26 авг, 01:18, Kevin Porter <[email protected]> wrote:
> >
> > >> >> Oops sorry! Posted without testing, I didn't realise you lost that
> > >> >> assignment notation with a $H() hash.
> >
> > >> >> - Kev
> >
> > >> >> DJ Mangus wrote:
> >
> > >> >>> what you want to do is h.set(input.id <http://input.id>,
> > >> >>> input.getValue())
> >
> > >> >>> Seehttp://www.prototypejs.org/api/hash/set
> >
> > >> >>> 2009/8/25 Kevin Porter <[email protected] <mailto:
> > >> [email protected]>>
> >
> > >> >>> Same:
> >
> > >> >>> var h = $H({});
> > >> >>> h[input.id <http://input.id>] = input.getValue();
> >
> > >> >>> - Kev
> >
> > >> >>> buda wrote:
> > >> >>> > Thanks for replay, but
> > >> >>> > I Do need to add it to a $H object !!!!
> >
> > >> >>> > how to do it? Thanks )
> >
> > >> >>> > On 26 авг, 00:14, Kevin Porter <[email protected]
> > >> >>> <mailto:[email protected]>> wrote:
> >
> > >> >>> >> var h = {};
> > >> >>> >> h[input.id <http://input.id>] = input.getValue();
> >
> > >> >>> >> Doesn't even need to be a $H(), just a regular JS object/hash.
> >
> > >> >>> >> - Kev
> >
> > >> >>> >> buda wrote:
> >
> > >> >>> >>> I need to add to a hash id of an input and its value
> > >> >>> >>> when I try to do
> >
> > >> >>> >>> var h = $H({});
> > >> >>> >>> h.update({ input.id <http://input.id>: input.getValue() });
> >
> > >> >>> >>> an error of bad syntax is generated
> >
> > >> >>> >>> how can I add an element to a hash which key is an input.id
> > >> >>> <http://input.id> and value
> > >> >>> >>> is an input.getValue()?
> >
> > >> >>> >>> Thanks
> >
> > >> >>> >> --
> > >> >>> >> Kevin Porter
> > >> >>> >> Advanced Web Construction
> > >> >>> Ltdhttp://webutils.co.ukhttp://billiardsearch.nethttp://
> > >> 9ballpool.co.uk
> > >> >>> <http://9ballpool.co.uk>
> >
> > >> >>> >> AJAX Blackjack - real-time multi-player blackjack game with no
> > >> >>> flash, java or software downloads required
> > >> >>>
> > >> >>> -http://blackjack.webutils.co.uk-Скрыть<http://blackjack.webutils.co.xn--uk--eed4aej5ek>цитируемый
> > >> >>> текст -
> >
> > >> >>> >> - Показать цитируемый текст -
> >
> > >> >>> --
> > >> >>> Kevin Porter
> > >> >>> Advanced Web Construction Ltd
> > >> >>> http://webutils.co.uk
> > >> >>> http://billiardsearch.net
> > >> >>> http://9ballpool.co.uk
> >
> > >> >>> AJAX Blackjack - real-time multi-player blackjack game with no
> > >> >>> flash, java or software downloads required -
> > >> >>> http://blackjack.webutils.co.uk
> >
> > >> >> --
> > >> >> Kevin Porter
> > >> >> Advanced Web Construction
> > >> Ltdhttp://webutils.co.ukhttp://billiardsearch.nethttp://9ballpool.co.uk
> >
> > >> >> AJAX Blackjack - real-time multi-player blackjack game with no flash,
> > >> java or software downloads required
> > >> -http://blackjack.webutils.co.uk-Скрыть цитируемый текст -
> >
> > >> >> - Показать цитируемый текст -
> >
> > >> --
> > >> Kevin Porter
> > >> Advanced Web Construction Ltd
> > >>http://webutils.co.uk
> > >>http://billiardsearch.net
> > >>http://9ballpool.co.uk
> >
> > >> AJAX Blackjack - real-time multi-player blackjack game with no flash,
> > >> java
> > >> or software downloads required -http://blackjack.webutils.co.uk- Скрыть
> > >> цитируемый текст -
> >
> > - Показать цитируемый текст -
> >
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---