$V, like $F but works with control groups
Reported by Fabien Ménager | May 13th, 2008 @ 10:24 AM
Hello, I've developed a new function using Prototype for an Open Source project that I think might be useful. It consists in a function like $F but that can be used with groups of radio buttons, and all kind of form elements without the need to know if it's a list of elements or a single one.
I've attached the file containing this function. Even if I've already tested it, and that we use it, I would like to know if you encounter any issue with it.
Comments and changes to this ticket
-
John-David Dalton May 13th, 2008 @ 02:51 PM
- → State changed from new to enhancement
-
Tobie Langel May 13th, 2008 @ 03:16 PM
We're typically trying to reduce the number of utility methods in use in Prototype
I'd advocate somehow rethinking that API.
-
John-David Dalton May 13th, 2008 @ 03:27 PM
When Prototype serializes the form it finds the radio button/checkbox in the group that has a checked value.
I guess one could modify the $F() to accept a nodeList or array of elements to get the checked elements value.
or
var group = [element1, element2, element3], value = group.findAll(function(element) return $(element).name == group[0].name }) .detect(function(element) { return element.checked }).getValue(); -
John-David Dalton May 13th, 2008 @ 03:28 PM
- → Title changed from A higher level form element get/set : $V to $V, like $F but works with control groups
-

Fabien Ménager May 13th, 2008 @ 03:29 PM
- → Title changed from $V, like $F but works with control groups to A higher level form element get/set : $V
In fact I named it $V to be able to continue using $F and getValue() that are used widely in our project. $F could be improved to be able to do all that my function can do (maybe by getting inspiration from $V) and to throw onchange events too (like mine)
-

Fabien Ménager May 13th, 2008 @ 03:30 PM
- → Title changed from A higher level form element get/set : $V to $V, like $F but works with control groups
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
The Prototype JavaScript library.
