[pmwiki-users] Wikiform - empty fields, numeric type, page names

John Rankin john.rankin at affinity.co.nz
Sun Dec 11 17:24:55 CST 2005


On Monday, 12 December 2005 3:33 AM, Andreas Mühlhausen <andreas at diemuehlis.de> wrote:
>Hi all,
>
>I have some questions about the wikiforms.
>
>1) I use the following WikiFormCSS.php - yes, I have renamed it on the 
>actual website:
>
>    <?php if (!defined('PmWiki')) exit();
>   
>    if (preg_match('/[.\\/]\\d{5}$/',$pagename)) $HTMLStylesFmt['form'] = "
>    #wikitext dt { float: left; margin-right: 0.2em; font-weight: bold; }
>    #wikitext dt:after { content: ':' }
>    #wikitext p { margin-left: 40px; }";
>   
>    ?>
>
>Everything works fine unless a field in the form is left empty. The 
>result is, that all headdings of empty fields are in one single line. As 
>I'm not very familiar with style sheets it would be very nice, if you 
>can give me a hint, what went wrong.

This is probably because the <dd> element is empty. Try the following:

    <?php if (!defined('PmWiki')) exit();
   
    if (preg_match('/[.\\/]\\d{5}$/',$pagename)) {
    $HTMLStylesFmt['form'] = "
    #wikitext dt { float: left; margin-right: 0.2em; font-weight: bold; }
    #wikitext dt:after { content: ':' }
    #wikitext p { margin-left: 40px; }";
    Markup('filler','<block','/^(:[^:]+:)$/','$1&nbsp;');
    }
   
    ?>

The markup rule says, "if you find an empty definition, display a non-
breaking space".

>
>2) Is it possible to define a numeric field type, because I want to use 
>a numeric ordering in the (:wikilist:)?

This can be added. To make the sort work, the form administrator will need 
to specify a length and the data will be automatically zero filled.

Do you need negative values? These are a bit trickier.

What I should *really* do is devise a way for administrators to add field
types as data, rather than adding to the core code...
>
>3) Is it possible to replace the numeric pagename with the contents of a 
>field?

In one of the field values, you can include (:title Some text for title:).
It would also be possible to add a new field data type that automatically
turns the text into a title. However, I'll have to think about how to
display this.

Hope this helps
John

-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list