create new tag
, view all tags
We are finding that users consider the WebForm that appears on every page as being too intrusive. It renders in the same font size as the rest of the page, and takes up quite a chunk of space on the page. As a result, we have made a few changes in our local TWiki which I'd like to share for comment.

We changed the routine renderFormData in TWiki.pm to use font size=-1, omit the title for each value and omit the title of the form itself (which is usually unhelpful anyway) and list all the elements horizontally. So you end up with something that would look like this for the current page:

Page Info FeatureBrainstorming CodeBaseProject N/A

Now this of course relies on the values being meaningful without the titles being present, something we are making an effort to do by choosing value names appropriately. If that is not possible, a fallback like this may be ok:

TopicClassification ProjectGroup ImplementationDate
FeatureBrainstorming CodeBaseProject N/A

If the titles are there, the form title becomes redundant.

So I guess what I'm really looking for is a way to customise the form display without having to edit TWiki.pm and then have to keep merging with future TWiki releases. Some stuff (eg form position) is already controllable by the skin, which is good, and we are using that to position the form in the bottom right of the screen where it does not interfere with the main view too much.

-- MartinWatt - 10 Sep 2002

I think the best solution would be for TWiki to output HTML with class, for the skin to add CSS style, e.g.:

  • have TWiki output:
    <table border="1" cellspacing="0" cellpadding="0" class="forms" > ...
  • declare in the skin CSS something like
    forms {font-size:small}
Of course, it would be nice to use different classes for different type of items: attachement tables, search results, forms, plain user tables...

-- ColasNahaboo - 10 Sep 2002

What should be done here is templatising(is that a word?) the form display. This way we can define the look of the form display to match any skins used etc... We would have to do this in sections, one template section for each Field that is displayed, and one each for the top and bottom... I might have a play with this today...

later that same day

okay.. i've finished implementing this in my local version, i'm not sure where the best place to stick this code is, so I will just include it here...

TWiki.pm - renderFormData

sub renderFormData
    my( $web, $topic, $meta ) = @_;

    my $metaText = "";

    my %form = $meta->findOne( "FORM" );
    if( %form ) {
        my $name = $form{"name"};

        my $frmhdtm = &TWiki::Store::readTemplate("form");
        my($tmfmTop, $tmfmPair, $tmfmFoot) = split(/%SPLIT%/, $frmhdtm);

        $tmfmTop  = &TWiki::handleCommonTags($tmfmTop,  $topic);
        $tmfmPair = &TWiki::handleCommonTags($tmfmPair, $topic);
        $tmfmFoot = &TWiki::handleCommonTags($tmfmFoot, $topic);

        $tmfmTop  =~ s/%FORMNAME%/$name/g;
        $metaText = $tmfmTop;

        my @fields = $meta->find( "FIELD" );
        foreach my $field ( @fields ) {
            my $title = $field->{"title"};
            my $value = $field->{"value"};

            my $tmpFld = $tmfmPair;
            $tmpFld =~ s/%PAIRTITLE%/$title/g;
            $tmpFld =~ s/%PAIRVALUE%/$value/g;
            $metaText .= $tmpFld;

        $metaText .= $tmfmFoot;
        $metaText = getRenderedVersion( $metaText, $web );
    return $metaText;

and I also have the default form display implemented, here is what the template looks like:


<table border="1" cellspacing="0" cellpadding="0">
<th colspan="2" align="center" bgcolor="#99CCCC"> %FORMNAME% </th></tr>
<tr><th bgcolor="#99CCCC" align="right"> %PAIRTITLE% :</th><td align="left"> %PAIRVALUE% </td></tr>

-- JaredQuinn - 11 Sep 2002

The need to customize form rendering is there -- actually, I hacked renderFormData go get more visibility. As to how:

make code cleaner, decrease page size, degrade gracefully and yes, they are skinable.
offer more rendering flexibility than css, renders on more platforms (eg PrintUsingPDF) but costs another file open to drag TWikiPerformance

Actually, this is true for all of TWiki code. So unless a general move to PreferencesAsStyleSheets and TWikiUsingCSS starts, it's probably more twikish to add yet another template...

-- PeterKlausner 11 Sep 2002

I definately agree that we need TWikiUsingCSS however, there will always be room for the templates, as it's not just the look most people will want to be changing, its the feel as well.

-- JaredQuinn - 12 Sep 2002

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2004-05-18 - MattWilkie
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.