Tags:
create new tag
, view all tags

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 History Action Size Date Who Comment
Texttxt CommentPluginNoForm.txt r1 manage 0.8 K 2004-09-30 - 14:54 MartinCleaver /lib/TWiki/Plugins/CommentPlugin/Comment.pm
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2006-04-06 - MeredithLesly
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.