Good day all,

I'm needing to conditionally remove or disable a FormFu element (Radiogroup) from within a Catalyst action/method. My first inclination was to simply make it readonly or hidden, but I soon discovered that adding those attributes via the 'add_attributes' method would only apply the attribute to some outer span and have no effect on the radio buttons themselves.

I'm now willing to accept just simply removing the element (Radiogroup) altogether. My strategy was to use one of the 'get_*' methods to retrieve the element, then use the 'remove_element' method to remove it. However, remove_element seems to be complaining that "element not found..." in which ever way I call the method. Of course, I've confirmed that the element is indeed being found by the 'get_*' method.

Here's a little code snippet of what I've got in my action:

if ($row_object->row_attribute) { my $foo_element = $form->get_field(type => 'Radiogroup', name => 'foo_element'); $form->remove_element($foo_element); }

Maybe someone can see what I'm doing wrong, or they can suggest an alternate strategy.

Thanks all

In reply to HTML::FormFu element removal... by s2cuts

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.