Multiple hide-whens on a single line

Hide-whens work on a per-line or per-cell basis for showing/hiding content. But what if there are different chunks of content you want to show/hide on the same line, depending on the conditions? For example:

  • buttons on a form or page, some of them you want to hide sometimes;
  • different status images;
  • pieces of text.

Sure, you can find ways with table cells, computed text or computed images. But there’s another way, at least on the web. In the client, I thought I could get it to work in Notes 6.5 earlier, but when I tested in Notes 7 and 8 today, it won’t give me what I want.

Here’s an example situation: imagine I want to show these 3 images.

3 images all visible, no hide-whens applied

Sometimes, depending on conditions from a hide-when formula, I only want to show 1 and 3:

Hide-when formula only showing one and two

How did I do that? Pass-thru html helped me out: take a look at the form in Designer:

Designer view on hide-when on one line

You’ll see some gray spots where pass-thru html spaces were added.

hide-when explaining image

I edited the image a little to show it better: red spots are spaces in pass-thru html, green spots are normal spaces.

If you create the line breaks in pass-thru by selecting the last space on one line and the first space on the next line, it’s not really a line break (technically it’s just a line break in your html source). This explains the red spaces in the form.

But wait! If you select spaces and images together and make them pass-thru, nothing shows up! That’s because if you surround an imported image resource by pass-thru html, it becomes pass-thru itself, meaning that the “text” is interpreted as html, meaning that no image will appear.

By adding a “normal” space in front of the image, selecting space and image and check it as not being pass-thru html, you can fix this. That’s what the green spaces mean.

Old news? I don’t know, I know it for a while, but discovered it myself. As always, it can be something that is know by many for years… Anyway, I wonder why it doesn’t work in the Notes Client? It’s like Notes threats the multiple lines as a single line and the hide-when at work is the one from the top line…

11 Comments

  1. Hi Martin,

    I use this approach all the time too. I’ve thought about writing about it in the past but have never known whether to.

    Knowing how to best use Passthru is a skill best picked up over time.

    Well done for covering the topic!

    Jake

    Reply
  2. Thanks Jake! I know, it seems rather trivial as a subject, but I’m sure there are people out there that never really thought about it.

    Reply
  3. I didn’t know this, so: thanks!

    Reply
  4. Even if only one soul is saved by this tip, this makes me happy ;-)

    Reply
  5. My soul is saved :) …I hate being forced to use tables for this type of thing …and I had thought that I must use tables or separate lines. So many thanks for an elegent solution!

    Reply
  6. This even works well with subforms thrown in! I’m a big fan of using subforms for anything, that has the slightest chance of being reused in the future (as I remember Jake is, telling by his old blog template anyway), including parts coded in pass-through HTML completely.

    While I find Designer’s habit of inheriting a subform’s hide-when formulas into the form pretty annoying, and the display of pass-through HTML could be further improved (by including some indicator for empty lines), this is still a powerful match. Once you have noticed that the contents of subforms doesn’t necessarily have to go on a new line, it opens up a whole new world of use cases.

    As always, your graphical illustration of the concept is outstanding and should make it easy for anybody to understand.

    Reply
  7. Subforms can add some extra line breaks in some cases: pass thru html comment tags can help then. Perhaps I’ll write this out in more details.
    Thanks Fabian!

    Reply
  8. Sometimes unfortunatelly it includes a linebreak:
    Add a table, put computed Text in it and mark it as html -> It adds a Linbreak in front of the computed text :-( If I remember correctly, it even happens if you just add a computed Text into a form, without the table…

    I wanted to add links (title…) via this, but I had to add a ‘click here:’ in the line in front of it otherwise I had a empty line there :-(

    Reply
  9. Did you try adding a (pass-thru) space in front of the computed text? Did you select the line with computed text + the line above it when you marked it as pass thru? These are the first things that come to mind. If you can’t figure it out, you can always mail me an example (martinATbeesign.be).

    Reply
  10. argh: ths links example should read: (a href=”notes:///0/UNID”)title(/a) with proper Tag-brackets… Hope it wors this time…

    Reply
  11. Ok, somehow the error is gone after trying to make a short example… could also be that this was a problem in 7.0.2, as I now have 7.0.3… Anyway: it’s gone, I’m happy :-)

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

8 + 1 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>