New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about : Answered

Not rendering setting edit fields when wrapped in a conditional HTML comment block

Interestingly - my post messes with Foswiki - use the edit viewer to see my question cleanly...

The following code will produce an "Edit Settings" button that changes to "Save new settings" "Cancel" but the Status setting will not change to a text box to be edited...
%IFACCESS{type = "change" else = "<!- -" glue = "off"}%

...{more stuff to conditionally hide}

   * Set Status = Nominal

...{more stuff to conditionally hide}


% IFACCESS {type = "change" then=" " else="- ->" glue = "off"}%

Removing the else clause from the first % IFACCESS{} % allows the editing of the setting to work properly...

Is there another way to achieve effect of conditionally hiding parts of a page where a preference setting may also need to be edited? Is this a bug? Am I misunderstanding something here?

-- JohnHart - 30 Apr 2014

HTML comments are a bit of a minefield. The biggest issue is that they are not allowed to be nested, although there is some browser inconsistency with this.

You might use a div or some other block, and set the style to display:none or display:block instead of using comments.

(I tried changing your comment to a encoded less/greater than symbol to see if that fixes the rendering. )

... That fixed the rendering of this topic, but rather killed your html comment So I'm not sure how to get a comment into a verbatim block without breaking things.

-- GeorgeClark - 30 Apr 2014

For anyone who may be interested... here's where I landed...

<!-- edit topic settings -->

<div class = 'editmode'>
   * Set Status =
   * Set Urgency = 
% EDITPREFERENCES{ "SettingSpecifierTopic" } %

<!-- view topic settings -->

<div class = 'viewmode'>
   * Status = %Status%
   * Urgency = %Urgency%

<!-- sytle attribute deactivate elements based upon whether or not the user has change (write) access to the topic -->

%IF{ "'TOPIC' allows 'change'" then = ".viewmode" else = ".editmode" }%

Using the style approach enables the simultaneous activation/deactivation of multiple screen elements

-- JohnHart - 01 May 2014

George - Thanks for the suggestion to use the < div > block

-- JohnHart - 01 May 2014

You might also look at Development/EnableWikiEditingOfSystemTopics#Implement_a_feedback_mechanism

Foswiki has some default classes assigned that can be used to show/hide controls based upon logged in status.

-- GeorgeClark - 01 May 2014

QuestionForm edit

Extension PreferencesPlugin
Version Foswiki 1.1.9
Status Answered
Related Topics
Topic revision: r4 - 01 May 2014, GeorgeClark - This page was cached on 21 Jun 2018 - 20:14.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy