Jump to content

Problems with container fields in HTML!

This topic is 8512 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I made a search page where you select one of the following categories for example A,B or C. Each category includes few businesses. Some of the businesses in the categories have a "banner -image" in their container field. I want the banners to appear on the "search results" page. I used the following CDML TAG (<IMG SRC="FMPro?-DB=mydatabase.fm3&-RecID=[FMP-CurrentRecID]&BANNER=&-Img" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom> ) The problem is that most of the businesses don't have a banner in their container field so the web browser displays a broken images in the list between the ones that actually work. Are there any ways to prevent those broken image logos? Is there a way to modify the tag so that filemaker skips the empty container fields while processing the list? Thanks.

Link to comment
Share on other sites

Put an [FMP-If][FMP-Else][/FMP-IF] on your html page. The IF checks whether the container field is empty (container.neq. ). If the field is NOT empty, display the graphic, ELSE nothing.

If the container.neq. expression refuses to work, create a calculationfield in your database that does the check, then test this check field on the html page.

Link to comment
Share on other sites

  • 5 months later...
  • Newbies

alternately, you can create a calculation field which generates the code for your image file automatically:

field value

image url (txt) a.jpg

image src (calc) <img src="a.jpg">

the calculation goes like this:

If( image url = "",


,"<img src=""images/" & image url & """>")

this way if you have a value in image url, it will create an image tag and if it has no value, no image tag will be created. obviously substitute "images/" with whatever is your directory structure.

you can also add attributes like border=0, a width and height value (helpful if it is standard, but even that's not necessary)

hope this is helpful. feel free to e-mail me if you have more questions.

Link to comment
Share on other sites

This topic is 8512 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.