Tags:
create new tag
view all tags

Question

(Please excuse the confusing formatting in my original post.)

On a form, is it possible to have a field that is not directly entered by the user, but rather calculated?
Given a form definition that contains MyField:

MyField label 1 %MYFIELD% Whatever

Now, in the doc that contains the form definition, if I do a

  • Set MYFIELD = abc
...when I save the form, MyField displays a value of abc.%br% However, if I look at the raw data, what is actually stored is:
%META:FIELD{name="MyField" title="MyField" value="%MYFIELD%"}%
...that is to say, that Twiki saves the formula (the variable to inherit from) and not the actual value.

So the topic containing the form looks nice when viewed, but if I include it, from a different topic, in a formatted search, a $formfield(MyField) renders as %MYFIELD%, whereas what I want to show is abc. Is there some way of doing this?

Environment

TWiki version: TWikiRelease04x00x05
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: HP-UX hp2 B.11.11 U 9000/800
Web server: Apache 3.0.99-563
Perl version: 5.6.1
Client OS: Win XP Pro SP4
Web Browser: MS Internet Explorer 6
Categories: Forms

-- RalphEllison - 11 Jan 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Hm, I don't have an answer, but a kind of workaround. If you use the

%CALC{$SET(myfield,Some Value)}%
construct instead of
   * Set MYFIELD = Some Value
within the topic with the form, containing the label
| MyField | label | 1 | %CALC{$GET(myfield)}% | Whatever |  |
you get the actual value Some Value of the 'variable' myfield when using $formfield(MyField) in a formatted search which result contains that topic with the form.

Or maybe AttachContentPlugin does what you really need, because IIRC the work-around above can't work in combination with (Set) variable settings.

-- FranzJosefSilli - 16 Jan 2007

Somewhat related: HowToStoreSearchResultsInAVariable.

-- PeterThoeny - 17 Jan 2007

Closing after more than 30 days. Please reopen with more details if needed...

-- PeterThoeny - 02 Mar 2007

Change status to:
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2007-03-02 - PeterThoeny
 
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.