Jump to content

Replace Yes/no Text With Images


Recommended Posts

This script assumes that you have set your YES/NO field to custom formatting, and to display the text "NO" for NO values and YES for YES values. If you have more than one YES/NO field, then you have to have unique text values to display unique images, such as

field1:

yes=YES1

no=NO1

 

field2:

yes=YES2

no=NO2

 

and you would adapt the script with additional "else if" conditionals.

 

In your footer, add

 

<script>
var elems = document.querySelectorAll("td span");
for (var i=0, m=elems.length; i<m; i++) {
    if (elems[i].innerHTML=="NO")  { 
        elems[i].innerHTML = "<img src=\"FULL_NO_IMAGE_PATH\">";
    }
    else if (elems[i].innerHTML=="YES"){
        elems[i].innerHTML = "<img src=\"FULL_YES_IMAGE_PATH\">";
    }
}
</script>

an example img tag would be:

elems[i].innerHTML = "<img src=\"http://example.com/image.jpg\">";

Could be used for small images like check marks for yes, a red x for no, stuff like that.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...