Yeah, I was hoping I wouldn't have to go that route. Ultimately if I can't figure this out I'll have to, but it seems unreasonable to not be able to delete one element from a form definition.

Why not?

To my mind, each screen is a different form, anything else is too complicated and reserved for client side javascript (ajax) manipulations :) I guess its a matter of perspective.

I'm not really up on HTML::FormFu::Manual::BasicConcepts, but remove_elements does appear to work

#!/usr/bin/perl -- use strict; use warnings; use HTML::FormFu; use YAML::XS qw( Load ); Main( @ARGV ); exit( 0 ); sub Main { Fain(); print "\n", '#' x 33 , "\n"; Fain( { dependOnMe => "if i'm not here, remove fooRadiogroup" } ); } sub Fain { my $cgi = shift; my $form = HTML::FormFu->new; my $data = Load(<<'__YAML__'); --- elements: - type: Text name: foo - type: Text name: dependOnMe - type: Radiogroup name: fooRadiogroup options: - value: 1 label: 'First' attributes: myattr: 'escape&attr' label_attributes: myattr: 'escape&label' container_attributes: myattr: 'escape&container' - value: 2 label: 'Second' attributes_xml: myattr: 'noescape&amp;' __YAML__ $form->populate($data); $form->process( $cgi ); if( not $form->valid('dependOnMe') ){ my $pariah = $form->get_field( name => 'fooRadiogroup', type = +> 'Radiogroup' ) ; $form->remove_element( $pariah ); } print $form; } __END__

In reply to Re^3: HTML::FormFu element removal... by Anonymous Monk
in thread 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.