Tapestry
  1. Tapestry
  2. TAPESTRY-2261

TriggerFragment mixin should work with Radio as well as Checkbox components

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.11
    • Fix Version/s: 5.0.12
    • Component/s: None
    • Labels:
      None

      Description

      Currently, it sees the radio being selected, but when a different radio is clicked, it doesn't hide the associated form fragment.

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        The issue is that you can observe the client-side "change" event, but that seems to only trigger when the Radio is selected; when it is de-selected (because a different radio was selected) there is no event, so you end up with both form fragments, when they should be exclusive.

        Show
        Howard M. Lewis Ship added a comment - The issue is that you can observe the client-side "change" event, but that seems to only trigger when the Radio is selected; when it is de-selected (because a different radio was selected) there is no event, so you end up with both form fragments, when they should be exclusive.
        Hide
        Howard M. Lewis Ship added a comment -

        Not the only ones who've hit this nasty:

        http://dev.rubyonrails.org/ticket/7895

        Show
        Howard M. Lewis Ship added a comment - Not the only ones who've hit this nasty: http://dev.rubyonrails.org/ticket/7895
        Hide
        Howard M. Lewis Ship added a comment -

        Here's a hack I'm using for a client:

        radioTriggerHack : function(radio, element)
        {
        var radio = $(radio);

        $(radio.form).observe("change", function() {

        var elem = $(element)

        if (! radio.checked && elem.visible())

        { elem.formFragment.hide(); }

        });
        }

        Basically, observe every change throughout the containing form, and use that as an opportunity to check to see if the element is visible but shouldn't be.

        This kind of thing could be integrated into tapestry.js, i.e., the FormFragment object could add this additional listener if the triggering object's type is "radio" (not "checkbox").

        Show
        Howard M. Lewis Ship added a comment - Here's a hack I'm using for a client: radioTriggerHack : function(radio, element) { var radio = $(radio); $(radio.form).observe("change", function() { var elem = $(element) if (! radio.checked && elem.visible()) { elem.formFragment.hide(); } }); } Basically, observe every change throughout the containing form, and use that as an opportunity to check to see if the element is visible but shouldn't be. This kind of thing could be integrated into tapestry.js, i.e., the FormFragment object could add this additional listener if the triggering object's type is "radio" (not "checkbox").

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development