Search these areas:
Support Forums
Product Info

-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Data Analysis
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

Support Forum

How to add Links to content that's pulled from a DB File?
Hettig asked:
I have my content stored with in a Database file.
I would like to add links throughout the content but my attempts have failed.  The system just posts the tags as text instead of links.  I have tried
<A class="" href=""> & <a href=""> but they have failed. Some assistance would be great! Thanks
  dougl responded:
  check out the encodeHTML() method on the response object.

Say, for example, your HTML formatted text is stored in a long-text field called myHTML. In your dataregion, you can output this text as HTML with the following script:

<ws:field name="myHTML" displaymodes="insert,update" />
<ws:htmlblock displaymodes="details">#response.encodeHTML( myHTML, true#</ws:htmlblock>

(note: the second parameter of the encodeHTML method will preserve your HTML text's layout..)

Let me know if this helps..
  peterhus responded:
  Access Hyperlink fields have a non-standard format of encoding an href and text in a single field.  The href is surrounded by "#" characters, and the text is whatever comes before it. 

So-- it's pretty easy to run a script once the data is in a Westside web to turn these fields back into link fields.  Take the suppliers table for example.  It gets uploaded with a  HomePage field that is exactly the contents of the hyperlink field.  an entry looks like:

Mayumi's (on the World Wide Web)#

Once uploaded, do the following:
1) Add two text fields to Suppliers, "HomePageText" and "HomePageHref".
2) create the following in a script file

webcall function convertHyperlink (tablename, HLinkFld, textFld, hrefFld)
    var filt=HLinkFld + "!='' ";
    var rs = Resultset(tablename, HLinkFld, filt);
    var textpart;
    var hrefpart;
    var i;
    var j;
    var setFlds = Object();
    while (
        i = rs[HLinkFld].indexOf("#");
        j = rs[HLinkFld].lastindexOf("#");   
        if (i>0)

        table.update(tablename, setFlds, rs.SupplierID);
    return("records updated: " + rs.getCount());


3) test the script and set the parameters to
tablename:  Suppliers
HLinkFld:  HomePage
textFld:  HomePageText
hrefFld:  HomePageHref

it should update 5 records

4) in the Suppliers datafolder, upload the following files from the same Office samples directory that contains the Northwind.mdb sample database:

5) Now add the HomePageText and HomePageHref fields to Suppliers/default.view.  Delete the existing HomePage field.

6) Click on the HomePageText field and find its "Link to Page" property in the property window.  Set it to #record.HomePageHref#.  Also, set the caption to "Home Page".

7) clieck on the HomePageHref field and uncheck the Grid and Details options for "Display in these Modes"

Now the HomePageText field should present a hyperlink in grid and details mode, and there are two different fields to edit in update/insert mode.

In V2, we'll add better support for links to uploaded files such as the CAJUN.HTM file in northwind.
  dougl responded:
  DataWeb considers this issue closed.
If you have additional questions or comments about this issue, please open it again.
If you have questions about a different topic please open a new support question.

DataWeb Support
  Please Log On
or create your own DataWeb Account.
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us