You are dealing with html here.
You must have the whole href in html format here and not just the name.
If you want a short cut you can search the txt and replace just the name (use
something lke ??txt and search for it).
e.g.
//[[SPIDER_EVENT<href_onBeforeHtmlOutputEvent>
public int href_onBeforeHtmlOutputEvent(CSpHtmlOutputEvent event)
{
String sDisplay =
CSpider.getWebEnvVar(CSpVars.SERVER_NAME).stringValue();
String sOldText = ((CSpDisplayField)event.getSource()).getHtmlText();
int iIndex1 = sOldText.indexOf("??email");
// CUtility.debug(" iIndex1 href = " + iIndex1 );
String sNewText = sOldText.substring(0,iIndex1) + sDisplay +
sOldText.substring(iIndex1 + 7);
((CSpDisplayField)event.getSource()).setHtmlText(sNewText);
return (PROCEED);
}
//]]SPIDER_EVENT<href_onBeforeHtmlOutputEvent>
"Jan Robison" <[EMAIL PROTECTED]> wrote:
>
>Hi,
>I am trying to change the text of an href dynamically.
>My problem is it that the text changes but the href looks like a static text.
>You cannot click on the href after the text is changed.
>
>Here is the code I am using can anyone tell me what I am doing wrong?
>
>Thanks
>
>public int Href1_onBeforeHtmlOutputEvent(CSpHtmlOutputEvent event)
>{
> CSpHref hrf = (CSpHref) event.getSource();
> String strText = "whatever";
> hrf.setHtmlText(strText);
> return (PROCEED);
>}
_________________________________________________________________________
To unsubscribe from this mailing list please send an email to:
[EMAIL PROTECTED]
Please remember to use the same email address you subscribed with.
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]