Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
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.

http://help.westside.com/default.view?Topic=objectmodel/response/response_encodehtml

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)#http://www.microsoft.com/accessdev/sampleapps/mayumi.htm#

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 (rs.next())
        {
        i = rs[HLinkFld].indexOf("#");
        j = rs[HLinkFld].lastindexOf("#");   
        textpart=rs[HLinkFld].substring(0,i);
        hrefpart=rs[HLinkFld].substring(i+1,j);
        if (i>0)
            setFlds[textFld]=textpart;
        else
            setFlds[textFld]=hrefpart;

        setFlds[hrefFld]=hrefpart;
        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:
CAJUN.HTM
CAJLOGO.GIF
FORMAGGI.HTM
FORLOGO.GIF
WHATSNEW.GIF

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.

Thanks,
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