r11 - 06 Apr 2006 - 18:53:44 - MeredithLeslyYou are here: TWiki >  Codev Web > AAaA?  > ComponentisingForceWikiWord
Tags:
, create new tag

Demo

i.e. I wrote...

%COMMENT{type="TopicNameConstrainer" field="MyFieldName" default="dns problem"}%

Origins

In TWikiRegistration has a JavaScript construct that converts something an uneducated (non Wiki aware) user might type in (like "dns problem") and converts it into a wikiword ("DnsProblem").

Change

So I have componentised this so that it can be used elsewhere. I'm thinking on forms, expecially those that have contact with newbies before they have got the (or indeed, will ever care about the) wiki movement.

Benefits

This:
  1. Make the code where constraint is needed more readable
  2. Facilitates this functionality appearing elsewhere
  3. Ensures that this functionality appears consistantly, leading to a more usable (and potentially more consistant) experience for users.

Note

This is different to constraining data entry on forms, as covered by FormFieldsPlugin and JavaScriptDatePickerForForm

Caveats

To include other fields on the same form one has to get Comment to emit no form. The attached CommentPluginNoForm.txt patch for /lib/TWiki/Plugins/CommentPlugin/Comment.pm drops the constructed form if noform="on" is present.

Credits

Crawford, again! For CommentPlugin!

-- MartinCleaver - 30 Sep 2004

Could you tell us a bit more on how to use this on other pages? Was TopicNameConstrainer already a setting in CommentsPlugin?

-- ArthurClemens - 30 Sep 2004

Sure. This is how I use it:

  1. Modify Comment.pm (see patch) write:
  2. Nope - I contructed UserTemplates#TopicNameConstrainer from the JavaScript in TWikiRegistrationPub? .
  3. Write this in a topic to make the said dialog a way to create new topics:
<form name="testonlynewtopic" action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/">
%COMMENT{type="TopicNameConstrainer" field="topic" default="RegulationSection" size="30" noform="on"}%
<input type="hidden" name="onlynewtopic" value="on" />
<input type="hidden" name="templatetopic" value="AspectOfRegulationTemplate" size="30"/> 
<input type="submit" value="Create topic" />
</form>

-- MartinCleaver - 30 Sep 2004

 
Topic attachments
I Attachment Action Size Date Who Comment
txttxt CommentPluginNoForm.txt manage 0.8 K 30 Sep 2004 - 14:54 MartinCleaver /lib/TWiki/Plugins/CommentPlugin/Comment.pm
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r11 < r10 < r9 < r8 < r7 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo