Tags:
create new tag
, view all tags

Question

How do you refer to a specific checkbox? I want to autofill some checkboxes within a form. I've tried using several variations on the theme of:

%CALC{"$IF($formfield(GoldenRetriever)==0),($formfield(dog.box1)=0),($formfield(dog.box1)=1)")}%"

or am I barking up the wrong tree?

Environment

TWiki version: TWikiRelease04x00x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Mandrake 8.1
Web server: Apache2.0.55
Perl version: 5.8.0
Client OS: WinXP SP2
Web Browser: Firefox 1.5
Categories: Forms

-- JoeDeal - 11 Apr 2006

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Hopefully to clarify, the checkboxes in question would "autocheck" dependent upon entries being made in other fields on the same form.

-- JoeDeal - 12 Apr 2006

You can do that with a CALC. Example using FORMFIELD:

%CALC{$IF($FIND(OsHPUX, $TRANSLATE(%FORMFIELD{OperatingSystem}%, $comma, ;)) < 1, , checked=\"checked\")}%

See example at Sandbox.BlahForm

If needed, you can use a SEARCH instead of a FORMFIELD. If done with a SEARCH you need to defer the CALC to fire off for each search hit. Something like: format="$percntCALC{$IF...)}$percnt"

-- PeterThoeny - 12 Apr 2006

FABULOUS! I would have never figured that out. Interesting how that works. I've got lots to sort out and learn. THANKS.

-- JoeDeal - 12 Apr 2006

 
Topic revision: r4 - 2006-04-12 - JoeDeal
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.