NetTalk Central

Author Topic: Multiple links in browse column?  (Read 5993 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Multiple links in browse column?
« on: September 09, 2013, 07:28:16 PM »
     I would like to take three columns in my NT 7.20 browse and combine them into one column.  Each of the three columns is a string set up as a link to a web page.  Individually, they work fine.  However, they take up a lot of screen real estate.  Thus I would like to combine them into one column, but have each link stacked on top of the other.  Of course the individual links still need to work. 
     Creating a new local field, and concatenating the three does not work.  Can anyone suggest a way to do this?

Thanks,

Jeff

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Multiple links in browse column?
« Reply #1 on: September 09, 2013, 09:51:38 PM »
Hi Jeff,

1. Create a new local field
2. Turn off sorting etc (or make it meaningful)
3. Turn on allow XHTML in column
4. In the correct embed point (validate record or similar) build your string like this.

urlLink = '<a href="'&CLIP(url1)&'">'&CLIP(text1)&'<a href="'&CLIP(url2)&'">'&CLIP(text2)&'<a href="'&CLIP(url3)&'">'&CLIP(text3)&'</a>'

You can either display the text on the browse as the link in which case the text fields would be replaced by the url fields.

You need to make sure it is XHTML complicant so maybe wrap it in _jsok or similar:

urlLink = p_web._jsok('<a href="'&CLIP(url1)&'">'&CLIP(text1)&'<a href="'&CLIP(url2)&'">'&CLIP(text2)&'<a href="'&CLIP(url3)&'">'&CLIP(text3)&'</a>')

But that should work fine.

Regards
Bill

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Multiple links in browse column?
« Reply #2 on: September 10, 2013, 08:25:16 AM »
Bill,

     Thanks for the tip.  This has achieved the effect I was looking for.  Please see the attached image. 

     However, it has created a problem.  When this new column is added to the browse, the Next/Previous buttons no longer work.  In addition, when calling a View to look at the form, I get an error about the key...the current record is not displayed in the form, only a blank record with an ID of 0.  If I comment out the code, then things return to normal.  So, it seems this code is causing an issue.  I have the following code in the Inside Browse Loop, Set Queue Record embed:

loc:Links = '<a href="'&CLIP(Ref:URL1)&'">'&CLIP('Link 1')&'<13,10><13,10>'&'<a href="'&CLIP(Ref:URL2)&'">'&CLIP('Link 2')&'<13,10><13,10>'&'<a href="'&CLIP(Ref:InternalURL)&'">'&CLIP('Internal Link')&'</a>'


Any thoughts as to what might be the problem?

Thanks,

Jeff

[attachment deleted by admin]

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Multiple links in browse column?
« Reply #3 on: September 10, 2013, 03:40:51 PM »
Hi Jeff,

note Bill's comment and example about _jsok and try again.

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Multiple links in browse column?
« Reply #4 on: September 10, 2013, 04:28:07 PM »
Hi Jeff,

Kevin's comments are correct. _jsok will encode the string so that it is XHTML compliant. If it is not you'll get exactly the behavior you are seeing now.

Regards
Bill

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Multiple links in browse column?
« Reply #5 on: September 10, 2013, 05:02:37 PM »
Bill and Kevin,

Thanks for your help.  I have tried wrapping _jsok around this code.  However, it no longer is displayed as XHTML...see the attached image.

By the way, the latest image shows another approach, where I'm using buttons at the end of each row to call the links.  This works well but I still prefer one column with all links.

Thanks,

Jeff

[attachment deleted by admin]

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Multiple links in browse column?
« Reply #6 on: September 10, 2013, 06:36:23 PM »
Hi Jeff,

Sorry I wasn't clear (well i was actually lazy and wrong).

You need to _jsok your strings but not the whole thing:

urlLink = '<a href="'&CLIP(p_web._jsok(url1))&'">'&CLIP(p_web._jsok(text1))&'<a href="'&CLIP(p_web._jsok(url2))&'">'&CLIP(p_web._jsok(text2))&'<a href="'&CLIP(p_web._jsok(url3))&'">'&CLIP(p_web._jsok(text3))&'</a>')

Regards
Bill

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Multiple links in browse column?
« Reply #7 on: September 11, 2013, 12:48:41 PM »
Bill,

     Thanks, but the browse navigation buttons still don't work when this code is in use.  If I comment out the code, things return to normal.  Is there a recommended embed for this code?

Jeff

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Multiple links in browse column?
« Reply #8 on: September 11, 2013, 02:52:14 PM »
Hi Jeff,

urlLink must be XHTML complicant.

Just post one example of the value of the loc:links field so we can see what is wrong. Just use p_web._trace(loc:links) and, install (if not already) dbgview.

Also, you are in a browser so <13,10> should be replaced with <br /> if you want a new line.

Regards
Bill

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Multiple links in browse column?
« Reply #9 on: September 11, 2013, 07:56:42 PM »
Bill,

     I changed the code to use just one link (URL1).  I loaded dbgview, then my web app.  Upon the browse opening, I got the first 4 entries in dbgview.  Upon clicking the Next button, I got the last 4 entries in dbgview.  In the attached image, notice the part of the link like .../pubmed/22957995.  It corresponds to the Accession number column of the browse.  It seems the next button is getting the correct next three records but the browse screen is not updating to reflect this.  This only happens with the code I put in the "3 Inside Browse Loop, 1 Validate Record" embed as follows:

  p_web._trace(loc:links)
  loc:Links = '<a href="'&CLIP(p_web._jsok(Ref:URL1))&'">'&CLIP(p_web._jsok('Link 1'))

Again, if I comment out this code, the Next button works as expected, i.e. it updates the browse showing the next three records.  Thoughts?

Jeff

[attachment deleted by admin]

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Multiple links in browse column?
« Reply #10 on: September 11, 2013, 08:02:05 PM »
Yeap, thats invalid! No closing </a>

should be:

loc:Links = '<a href="'&CLIP(p_web._jsok(Ref:URL1))&'">'&CLIP(p_web._jsok('Link 1'))&'</a>'

Either i cannot type or the some of the HTML is getting screwed up when posting.

The syntax for an anchor link is:

<a href="URL">text</a>


Regards
Bill


kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: Multiple links in browse column?
« Reply #11 on: September 11, 2013, 08:21:40 PM »
Bill,

     You are correct!  Also, the <br> tag must be <br />.  Fixing both of these seems to have done it.  Thanks for sticking with me on this.

Jeff

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Multiple links in browse column?
« Reply #12 on: September 11, 2013, 08:28:26 PM »
No worries, its slow and clumsy when each iteration takes a day!

You are correct: <br /> is the XHTML version of <br>

Same as <img src=""> needs to be <img src="" />

All tags must close in XHTML.

I'm glad its sorted.