We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Support Web>DisplayFormFieldinTopic (01 Aug 2002, PeterThoeny)
Tags:
create new tag
, view all tags

Question

It seems like it should be simple enough but I have not been able to figure out how to display the value of one of the fields in TWikiForms elsewhere within the same topic. I am wanting to do this as part of my implementation of AllowDesignationOfSummary inwhich I create a topic summary or "headline" field within the WebForm and would also like to display this field value at the top of the topic.

Thanks for any help!

-- LynnwoodBrown - 31 May 2002

Answer

You can do this with a FormattedSearch. The example pull the SupportStatus out of this topic.

  • You type: %SEARCH{ "^%TOPIC%[^a-zA-Z0-9]" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(SupportStatus)" }%

  • You get:

-- PeterThoeny - 31 May 2002

Thanks, Peter! That's exactly what I was after. Looking at the search string, I am once again impressed how arcane regular expressions are to the uninitated. Since the search string here is so short, I though it would be a good example for me to try to deconstruct and understand how this string identifies the current topic - but no luck.

Anyone willing to help me understand this simple regular expression? Why not just have the %TOPIC% variable by itself in the search string?

-- LynnwoodBrown - 31 May 2002

The [^a-zA-Z0-9] matches a single non-alphanumeric character - the idea is to only find ThisTopic not ThisTopicAsWell, since the pattern ThisTopic[^a-zA-Z0-9] will only match the former. Have a look at a regular expression tutorial and try writing some expressions yourself - much easier to experiment yourself as part of learning.

See Wikilearn.RegexExpTWikiEndAnchorWorkaround -- RandyKramer - 01 Jun 2002.

-- RichardDonkin - 31 May 2002

"^%TOPIC%[^a-zA-Z0-9]" is not the correct regex to find exactly %TOPIC% without leading or trailing characters. This is because the regex finishes scanning with a match at "not followed by a alphanumeric character".

"^%TOPIC%$" is the correct regex. Note that this requires the CantAnchorSearchREToEnd fix.

-- PeterThoeny - 01 Aug 2002

Topic revision: r9 - 01 Aug 2002 - 07:27:51 - PeterThoeny
 
TWIKI.NET
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