#95 √ inactive
Fabien Ménager

$V, like $F but works with control groups

Reported by Fabien Ménager | May 13th, 2008 @ 12:24 PM

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

    John-David Dalton May 13th, 2008 @ 04:51 PM

    • → State changed from “new” to “enhancement”
  • Tobie Langel

    Tobie Langel May 13th, 2008 @ 05: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

    John-David Dalton May 13th, 2008 @ 05: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

    John-David Dalton May 13th, 2008 @ 05: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

    Fabien Ménager May 13th, 2008 @ 05: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

    Fabien Ménager May 13th, 2008 @ 05:30 PM

    • → Title changed from “A higher level form element get/set : $V” to “$V, like $F but works with control groups”
  • Tobie Langel

    Tobie Langel November 22nd, 2008 @ 05:22 PM

    • → Tag changed from “” to “form forms function needs_tests”
    • → State changed from “enhancement” to “inactive”

    Closing this ticket as inactive.

    Please reopen it with a firm API proposal (coded, documented and tested). Thank you.

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.

Shared Ticket Bins

Attachments