On Jan 8, 9:33 am, Ken Snyder <[EMAIL PROTECTED]> wrote:
> Mislav Marohnić wrote:
> > ...
>
> >     - Add intuitive Prototype methods for checkbox- and radio-group form
> >     elements ( e.g. a method to get the value of the currently checked
> >     item(s) in based on a group name)
>
> > Hmm, we have it for select boxes and multiple selects, why not radio
> > buttons/checkboxes? You could open up an enhancement ticket for this
> > request and propose an API for this. Or find a way to re-use the
> > existing (get/setValue) API?
> > ...
>
> Here is a brainstorm:http://pastie.caboo.se/136408
> Is it intuitive, though?
>
> I would have expected the whole serializing system to go by name instead
> of element. I think it is too late to change that because it would break
> the way some people are currently using $F(). But maybe the brainstorm
> above is a good approach?
>
> - Ken

This has annoyed me enough that I'm now using an extension that adds
Form.Field which accesses form elements by name:
   http://www.xprime.com.au/prototype_form-field.js
I now use:
      * Form.Field.getValue('fieldName')
      * Form.Field.setValue('fieldName', value)
      * Form.Field.observe('fieldName', 'eventType', listener)
      * Form.Field.stopObserving('fieldName', 'eventType', listener)
and don't need to use Form.Element (or $F()) now for most things
because this can be used for both grouped and singular form elements.
A couple of things in there that some might find disturbing though; it
uses the CSS selector to get the elements (could/should do a walk
through elements and match tagName and name attributes instead) and it
has a cache to speed it up which may not be needed if the CSS selector
usage is removed. The cache has to be cleared if the relevant parts of
the DOM is changed (Form.Field.NamedCache.clear()), there is a hook in
there for Ajax calls which may or may not help when changing the DOM
with Ajax.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to