John,
If you want to construct an HTML tag and put it into your page, THE
place to do it is:
>>>onBeforeHtmlOutput(..)<<< of the Display Field concerned using
>>>((CSpDiplayField)event.getSource()).setHtmlText(....)<<<
If you do setValue in onBeforeDisplay(..), ND will convert your
string so that in the final HTML page, you get to see exactly what you set
and if you look at the Html source you see & stuff.
I would prefer to construct the string in the onBeforeDisplayEvent
of the page and keep the value in an Instance variable for use in
displayField_onBeforeHtmlOutput(..)
Aby
> -----Original Message-----
> From: Wehner, John [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, April 30, 1999 12:22 PM
> To: [EMAIL PROTECTED]
> Subject: [ND] URL Tag for a Display Field
>
> I have a field in my database with a URL I want to create a link to like
> this:
> <A href="urlAddress">urlAddress</A>.
> I got this to work using the UserDefinedHtml property of the display
> field.
> This seems to work just fine, and when urlAddress is blank, nothing is
> displayed, and no link appears on the page. Good.
>
> If I wanted to use another display field in place of the urlAddress link
> text, <A href="urlAddress">linkTextField</A>, then this doesn't work.
>
> I was wondering how to do this using Java.
> Here is the code I used for the WebPage display field:
>
> //[[SPIDER_EVENT<WebPage_onBeforeDisplayEvent>
> public int Manufacturer_onBeforeDisplayEvent(CSpDisplayEvent event)
> {
> CSpSelect doMfr=(CSpSelect)
> CSpider.getDataObject("DoManufacturer");
> CSpValue urlAddress = doMfr.getValue(0,"WebPage");
> CSpValue mfrName = doMfr.getValue(0,"Manufacturer");
> if(urlAddress.isNull()){
> setDisplayFieldValue("WebPage", new CSpString(""));
> }
> else {
> setDisplayFieldValue("WebPage", new CSpString("<A href=\"" +
> urlAddress + "\">" + mfrName + "</A>"));
> }
> return (PROCEED);
> }
> //]]SPIDER_EVENT<Manufacturer_onBeforeDisplayEvent>
>
> This, however, interprets my '<' and quotes incorrectly and the html that
> is
> generated lookes like this:
>
> <A
> href="http://www.analog.com/index.html">http://www.analog.com
> /i
> ndex.html</A>
>
> The <, ", and > is my problem.
>
> Can anybody help me with the solution?
> Thank you,
> John
>
>
> _________________________________________________________________________
>
> 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]
_________________________________________________________________________
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]