Page 1 of 1

How to account for empty fields

Posted: Sun Oct 12, 2025 7:07 pm
by Paul
I have my Browse form code that displays records with hyperlinks to files when the Print button is clicked.
(See viewtopic.php?t=12663)

In the Browse form edit screeen, I have this as an example:
Title: Audio 5 URL
Display:

Code: Select all

CONCAT('<a href="', pk_audio_url_5, '" target="_blank" download>Download Audio 5</a>')
If pk_audio_url_5 happens to be blank (nothing was entered in the audio file url field) then I get a url like this in the displayed Print page:

Code: Select all

http://localhost/nubuilder2/core/nurunhtml.php?i=68ebda6957edf1f
which is bad.

Other than deleting the display code entirely (not prefereable), how do I account for empty fields?

Re: How to account for empty fields

Posted: Sun Oct 12, 2025 7:17 pm
by Paul
ChatGPT answered my question:

Code: Select all

IF(
  pk_audio_url_5 <> '',
  CONCAT('<a href="', pk_audio_url_5, '" target="_blank" download>Download Audio 5</a>'),
  'No audio available'
)