Support » Plugin: WP Data Access » Can a hyperlink column not display a link until it gets one assigned?

  • Resolved dizwell

    (@dizwell)


    Hello Peter:

    I haven’t used the ‘make this column hyperlink’ feature a lot before now, but I am on the current Bach catalogue. And I’ve noticed that the way the back end works, you can assign the ‘Link Text’ separately from the associated ‘URL’ -which is a good thing!

    But often, I know what the link text will be (the name of a Bach cantata) before I know what the URL will be (the article where I -eventually!- get around to discussing that cantata). So I will often add the link text with *no* associated URL.

    It would be helpful then to be able to distinguish those bits of link texts which I have properly and completely linked, from those which are merely link texts with no associated URL because I haven’t got round to writing the article yet.

    Unfortunately, both on the back end and on the front, columns which are declared to be of type hyperlink are displayed as hyperlinks, which are clickable, whether a URL has actually been associated with the link text or not.

    I’ve added a fake entry for BWV 0099 in my table on the page in question so you can see the problem in action: the words ‘On the to-do list’ appear clickable, and can actually be clicked, even though I’ve not associated a URL with them yet.

    Now, fine: when you click that un-asscociated link text like that one, you merely cycle back to the page you’re on -so no major harm is done. But *visually*, you would expect to be taken to a new page and not doing so is a bit jarring. For me, too, it means it’s impossible to tell the difference between items in a list for which I’ve already written an article and items which still need new articles written.

    So, my long-winded feature enhancement request: is it possible for hyperlink columns that have link text but no URL (yet) to be displayed as ordinary text, without looking like they are a link that can be clicked? And can that be done on both the front and back ends?

    That way, I can cue up a list of articles that need to be written (by adding them to my table now) without the hyperlinks looking like a ‘real’ hyperlink that would actually do something when clicked.

    It’s a tiny, tiny detail, so no worries if it’s not likely to get on your agenda any time soon.

    Best wishes,
    HJR

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Howard,

    You can use javascript to add conditional logic to your dynamic hyperlink, like this:

    <script>
      if (""!="$$url$$") {
         document.write("<a href=\"$$url$$">Read more...</a>");
      }
    </script>

    If you add this javascript code to the HTML field of your hyperlink, the plugin generates a hyperlink if column url contains a hyperlink (a value). If column url is empty, no hyperlink is shown.

    Be aware, that the script tag MUST BE the first text you enter. Make sure there are no blanks before your script tag.

    Is this what you were looking for?

    Best regards,
    Peter

    Thread Starter dizwell

    (@dizwell)

    Hi Peter,

    I don’t think I’m using dynamic hyperlinks, actually. I’m simply declaring the column to be varchar in table design, then in Data Explorer -> Manager -> Settings -> Column Settings, I use ‘Hyperlink’ for the column type. I am not expanding the ‘dynamic hyperlink’ option and doing anything there. I think that means I’m using ‘static hyperlinks’!

    So, I can see that your code will logically work, but I think it’s a lot more elaborate than I was wanting, or if it’s appropriate to non-dynamic hyperlinks.

    I was thinking more that the plugin should programmatically not wrap < a href=”” > around link text until a link URL is provided. Or do something with the CSS, so that an < a href=”” > gets coloured differently from a < a href=”some-actual-link.html” > hyperlink. Or something.

    šŸ™‚

    No worries, though.
    Howard

    • This reply was modified 2 years, 1 month ago by dizwell.
    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Sorry Howard, looks like I misunderstood your question… šŸ™ˆ

    The point is, a static hyperlink should work exactly the way you expect it to. Can you check if there is a blank in your URL column? The plugin checks for empty URLs and null values.

    Thanks,
    Peter

    Thread Starter dizwell

    (@dizwell)

    Hello Peter:

    I probably haven’t explained it very well and it doesn’t help without pictures. So could you please take a look at:

    https://absolutelybaching.com/url-problem/

    …and see if that explains it better.

    So when you say ‘check if there’s a blank in your URL column’, I don’t really understand, since in a hyperlink column, you get to specify two different bits of information (link text and URL), and I want to be able to specify one but not the other. So no, that column won’t be *completely* empty, but if the link text is present *without* the URL element, I want it to be treated/displayed as plain text, not as a clickable hyperlink.

    Hopefully, that webpage explains it better in pictures than I can do in text!

    Regards
    HJR

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Yes, that explains it much better! šŸ™‚

    You want to add a label without a URL. Now I get it! It is in the next version. Just needed to add an if statement. Sorry for playing such a dumb-ass… šŸ™‚

    Can you wait for the next release? Or do you want to install it from a ZIP file?

    Best regards,
    Peter

    Thread Starter dizwell

    (@dizwell)

    šŸ™‚

    I am happy to wait for the next release.

    Many thanks as always,
    HJR

    Thread Starter dizwell

    (@dizwell)

    Hello Peter:

    That was quick! I have just updated to 3.14 and I see that on the back-end, the items without a URL element now appear as plain text, just as I desired šŸ™‚ This is a great productivity-booster for me.

    Unfortunately, the front-end still shows the un-URL’d items as clickable and undifferentiated from those table rows that have URLs assigned.

    See https://absolutelybaching.com/url-problem/ for an explanation with pictures! (I’ve updated it since last time).

    Am I just jumping the gun and the front-end fix will be in a future release that I just need to wait for? Or were you only intending to make the change to the back-end in the first place?

    No rush. Just thought I’d ask!

    Best wishes,
    HJR

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Sorry Howard!

    You are right. I missed the front-end. šŸ™ˆ It’s in the next release…

    Thank you for feedback and patience!

    Best regards,
    Peter

    Thread Starter dizwell

    (@dizwell)

    No worries!
    HJR

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Howard,

    I released version 3.1.5. Your hyperlinks should now work correctly in publications as well. šŸ™‚

    Best regards,
    Peter

    Thread Starter dizwell

    (@dizwell)

    Hello Peter:

    Thank you. Can confirm that the new release is correctly displaying not-yet-linked hyperlinks on both the front and back ends now.

    Thanks for the fix! And please feel free to close this issue.

    Best wishes,
    HJR

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Can a hyperlink column not display a link until it gets one assigned?’ is closed to new replies.