Dynamic href and computed fields

I am trying to create dynamic href’s that could call a function to hide/show divs on a form. I want to be able to have the value that the customer clicks on to be the acutal first name (based on a field value).

I have been able to do this with buttons by changing the value but the button. I searched the the forum and found the following reference from Stan Rogers, but was not able to get it work for me.

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/6b39ed8c3997851685256d7f0076ccab?OpenDocument

Does anyone know of a way that I can accomplish this without buttons.

Subject: dynamic href and computed fields

Sure. Your link is going to be an tag, right? All it needs to make it easily accessible is an id value. (You can do that either by using the tab of the link properties, if you build the link in Notes, or by using passthru HTML.) If you used the idea from the post you linked to, it won’t work because the text is not a direct child of the , it’s a child of the that lives inside the . Other than that, though, it’s the same process. Let me know if you have any more problems with this.

Subject: RE: dynamic href and computed fields

Yes I am using an tag and i am using pass thru html.

Here is what I have so far.

Pass Thru HTML

Primary

JS Header

function steps(show)

{

switch(show.toLowerCase())

{

case “family”:

document.getElementById(“plan”).style.display=“”;

document.getElementById(“addassociate”).style.display=“”;

document.getElementById(“submitind”).style.display=“none”;

document.getElementById(“primary”).style.display=“”;

document.getElementById(“associate”).style.display=“none”;

document.getElementById(“bcprimary”).value=document.forms[0].value;

break;

}

}

But I am not sure how to get a handle on the text, so that I can change primary to Kelly. I know for the button I do value=vaule but there is no value for the href, it is plan text.

Subject: RE: dynamic href and computed fields

You are trying to use the “.value” – use “.text” or “.data” instead.

Subject: RE: dynamic href and computed fields

I changed my JS function to read

document.getElementById(“bcprimary”).text=document.forms[0].FName.value;

and then tried

document.getElementById(“bcprimary”).data=document.forms[0].FName.value;

and it does not change the text from Primary to Kelly.

Subject: RE: dynamic href and computed fields

Ahem – although there’s nothing wrong with the code as is, browsers seem to believe that there’s only a “getter” for the text/data value of an anchor tag; no “setter”. Well, let’s just see about that! You’ll need to go through the text node that lives inside the :

var allChildren = document.getElementById(“bcprimary”).childNodes;

for (i = 0; i<allChildren.length; i++) {

if (allChildren[i].nodeType == 3) {

allChildren[i].data = document.forms[0].FName.value;

}

}

That’s been tested in IE6 and Mozilla.

Subject: Now thats Cool. Thanks, Stan.

Subject: RE: dynamic href and computed fields

Thank you very much, it worked great.