BizzyBee’s BizzyThoughts

Think Outside The Hive - About Notes and Web
 
 

Create computed action hotspots on the flie using @Formula


We know the power of action and link hotspots. It would be great if we could create them computed, f.e. to give it a computed description or to create a number of hotspots that can vary. I’m sure you know some applications for this yourself (just nostalgically think of those times you bumped your head against the wall in rage ;-)).

It turns out not to be that difficult, but there are some gotchas and restrictions. But don’t be afraid, I’ll take you by the hand and show you where the mines are…

How does it look?

It could look like this:

Computed action hotspots using @Formula

The basics

The months in this example are generated in a computed value with @Formula. The computed value is marked as passthru html.

I used a multivalue field CostMonth and with a @For-loop I wrapped a link around every value.

@For(i:=1;i<=@Elements(CostMonth);i:=i+1;

   @If(i=1;LB:=“”;LB:=“<br>”);

   link1:=“javascript:clickRow(”+@Text(i)+“)”;

   result:=result+LB+“<a href=\”“+link1+”\“>”+CostMonth[i]+“</a>”

);

The link is actually a link to a JavaScript function in the JSHeader that presses a button for us. Something like:

function clickRow(row) { document.forms[0].myButton.click(); }

Don’t forget to give the name/id “myButton” to that button. The button itselfs can hold formula, lotusscript or whatever your heart desires.

I used linebreaks <br> for new lines, I tested with <br/> as well, this didn’t work. But, we’re not there yet, this is the result so far:

Simple action hotspots

Hey, that’s not the font I want! That’s not the color I like!

Changing font, color and interlines

I tried css to change the look of the links, but I had little to no success. Alternative: surrounding the link tags with <font> tags. This can alter the font color and font face.

Oh, but there was trouble, there were headaches, there was darkness! If I put the font tag outside of the link tag, the color didn’t change (because it took the default link color over. If I put it inside of the link tag, the interline is huge (and that makes sense, because the font is still wrong outside of the link tag).

So, what I did was changing the size and face outside of the link tag, and changing the color in the link tag. The code becomes:

@For(i:=1;i<=@Elements(CostMonth);i:=i+1;

   @If(i=1;LB:=“”;LB:=“<br/>”);

   link1:=“javascript:clickRow(”+@Text(i)+“)”;

   result:=result+LB+“<font size=\”0\” face=\”Tahoma\“><b><a href=\”“+link1+”\“><font color=\”#0082BF\“>”+CostMonth[i]+“</font></a></b></font>”

);

Taking it further

Buttons can be generated with passthru as well, here’s an example:

@For(i:=1;i<=@Elements(CostMonth);i:=i+1;

   @If(i=1;LB:=“”;LB:=“<br>”);

   link1:=“javascript:clickRow(”+@Text(i)+“)”;

   result:=result+LB+“<font size=\”0\” face=\”Tahoma\“><input type=button value=\”“+CostMonth[i]+”\” onClick=\”“+link1+”\“/></font>”

);

Images can be used as well, but this is a bit more cumbersome, because the images will need the http task to be shown, so I don’t really recommend this.


1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

6 Responses to “Create computed action hotspots on the flie using @Formula”

  1. Gravatar Jan Schulz says:

    This works nicely with notes://server/replica/0/docid Links to. I used this to do some “See also: . Unfortunatelly haveing computed html text seems to require, that there is a linebreak in front of it, so you can’t put such a link inside your normal text unles you put teh rest of the paragraph into the same passthru computed text.

  2. Gravatar Eugene says:

    Nice article. Thanks. :) Eugene

  3. Gravatar Martin Vereecken says:

    You’re welcome!

  4. Gravatar Cesar Moves says:

    I’m a teacher of entrepreneurship in our school, and I think this document of yours can be of help to me and my students to become successful someday. Thanks a lot. god blezzz

  5. Gravatar Jan Schulz says:

    This is such a cool technique: finaly translations for buttons! Now only two places remain: view headers and the labels for “action with subaction” (seems a bug, actions itself are using the right computed label)

  6. Gravatar Tim Reynolds says:

    Nice post. Thank you for the info. Keep it up.

Leave a Reply