Friday, March 17 2006

Hide-when sections: HideStart/HideEnd

Lotus Notes has a hide-when feature, which Tornado also supports. This allows you to dynamically hide controls and blocks of html text

visible text before
<P@HideStart name="x" value="false" @P>
MAYBE HIDDEN BLOCK
<P@HideEnd name="x" @P>
visible text after

The example above shows a hide block (named and referred to as "x"). In your action code, simply set the value of "x" to true and the entire block will not be sent to the browser, eg:

any of the following will hide the block:
ActionDocument.setItemValue("x", true);
ActionDocument.setItemValue("x", "true");
ActionDocument.setItemValue("x", "yes");
ActionDocument.setItemValue("x", 1);
ActionDocument.setItemValue("x", "1");

The value parameter can be defaulted to hide or show by setting to true or false, thus it would be possible to comment your html code and not have it sent to the browser. Alternatively a debug block could be added to every page and shown only when the application is put into debug mode.

You can also use a keyword to control whether the block is shown:
<P@HideStart name="x" useKeyword="somekw" @P>text<P@HideEnd name="x" @P>
In this example, when the keyword "somekw" is set to a value that evaluates to true, the block will be hidden. In this way chunks can be globally hidden and shown very easily.

Hide blocks may be nested. Hiding the outermost block will hide all it contains, even if those inner blocks are set to show. 

Recent Comments

Thanks guys, I just about lost it looknig for this.
Posted by galent42 at gmail.com   on   26.Jul.11 20:07
URHBez ogfgzosrftqt
Posted by pwmwix at ucnnrg.com   on   27.Jul.11 21:24
dental health insurance 8620 family health insurance quote ofj
Posted by o-ukondo at juno.ocn.ne.jp   on   31.Jul.11 12:09
life insurance quotes tmdxpt auto insurance >:[[[
Posted by SeiwaDnk at nirai.ne.jp   on   02.Aug.11 11:05
car insurance qoutes =-OOO life insurance quotes 5110
Posted by naha at mangasouko.com   on   11.Aug.11 12:31
Show all comments
Got something to say? Add comment