[ic] [table-editor] requires {TOP_OF_FORM}

Mike Heins interchange-users@icdevgroup.org
Sun May 11 00:05:23 2003


Quoting Dan Browning (dbml@kavod.com):
> Lately I've been saving myself hours and hours by using the wondrous [table-editor] in 4.9 CVS.  But it seems that [table-editor] will not display anything if you omit the {TOP_OF_FORM} and {BOTTOM_OF_FORM}.
> 
> Problem demonstration:
> 
> <form>
> [table-editor table=country]
>         {HIDDEN_FIELDS} <table> {:REST} </table> 
> [/table-editor]
> ... lots of other stuff here ...
> [button text="Next"]mv_nextpage=aboutus[/button]
> </form>
> 
> Work-around:
> 
> <form>
> [table-editor table=country]
>         [tmp a]{TOP_OF_FORM}[/tmp]
>         {HIDDEN_FIELDS} <table> {:REST} </table> 
>         [tmp a]{BOTTOM_OF_FORM}[/tmp]
> [/table-editor]
> ... lots of other stuff here ...
> [button text="Next"]mv_nextpage=aboutus[/button]
> </form>
> 
> Notice how we still get the effect of removing TOP_OF_FORM by using [tmp][/tmp].
> 
> Is this the desired behavior?  (In other words, am I the only one who wants to embed table-editor within their own <form>?)

It was supposed to protect people against themselves, but I guess I
shouldn't do that. 8-)

        $overall_template =~ /{TOP_OF_FORM}/
            or return $death->('TOP_OF_FORM');
        $overall_template =~ /{HIDDEN_FIELDS}/
            or return $death->('HIDDEN_FIELDS');
        $overall_template =~ /{BOTTOM_OF_FORM}/
            or return $death->('BOTTOM_OF_FORM');

I will make this:

        $overall_template =~ /{TOP_OF_FORM}/
	    or $opt->{i_really_mean_it}
            or return $death->('TOP_OF_FORM');
        $overall_template =~ /{HIDDEN_FIELDS}/
	    or $opt->{i_really_mean_it}
            or return $death->('HIDDEN_FIELDS');
        $overall_template =~ /{BOTTOM_OF_FORM}/
	    or $opt->{i_really_mean_it}
            or return $death->('BOTTOM_OF_FORM');

I guess i-really-mean-it=1 is not very intuitive, but I am
running out of option names for table editor. Perhaps

	[table-editor incomplete-form-ok=1 ...]

I made it:

        unless($opt->{incomplete_form_ok}) {
            $overall_template =~ /{TOP_OF_FORM}/
                or return $death->('TOP_OF_FORM');
            $overall_template =~ /{HIDDEN_FIELDS}/
                or return $death->('HIDDEN_FIELDS');
            $overall_template =~ /{BOTTOM_OF_FORM}/
                or return $death->('BOTTOM_OF_FORM');
        }

That is now in CVS.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

"Even if you're on the right track, you'll get run over if you just
sit there." -- Will Rogers