Jump to content

Hide "No File Chosen" on tabular report


Recommended Posts

Hi there,

I needed to hide "No File Chosen" when a file field is left blank. If the file is chose, the file name should be displayed 

image.png.480a9f66080d71b1b29e49c3f5069c53.png

Here is a solution I came up with:

 

<script>
if (typeof mainF=='undefined') {
const hideInputText = (e) => {
if (e.target.getAttribute('type')== "file") {
   if (e.target.files.length > 0) {
      e.target.style.color = 'black'}
   else {
         e.target.style.color = 'transparent'}
}
}

const mainF = () => {
document.querySelector('head').insertAdjacentHTML('beforeend', `<style> input.cbResultSetFile[type="file"] {color: transparent}</style>`)
document.addEventListener('change', hideInputText, true)
}

document.addEventListener('DataPageReady', mainF, {once : true})
}
</script>

Just copy this code snippet to t he header or footer of your DataPage.

This is how it will look after code is applied:

image.png.f2a7beb25d0cd7d9ff71c1c90dff1d1d.png


I hope someone will find this useful

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...