Jump to content

Add status emoji once a file is uploaded


Recommended Posts

Hi, guys. Sharing this solution with you on how to add an emoji status once a user uploads a file (any type of file) in a submission form.

Without file:

image.png.63c1dd077fc6ae55139c545b65004997.png

With file:

image.png.8fe1e6b5cca113f54d77a4125d84f4ca.png

 

For this, we will be needing a File field, Virtual field, and the Status field (text field) where we will be saving the status emoji. The use of the Virtual field is to display the emojis . Add a header and footer and insert the code below on the footer:

<script>

document.addEventListener('DataPageReady', function (event) {

var stat= document.querySelector("input[name='InsertRecordStatus']");
var label= document.querySelector("div[data-cb-cell-name*='cbParamVirtual1']");
var file = document.querySelector("input[name='InsertRecordFile1']");

 if (file.files.length == 0) {
                    stat.value = "";
                    label.innerHTML = "";
                } else {
                    stat.value = "✔️";
                    label.innerHTML = "✔️";
                }

document.querySelector("input[name='InsertRecordFile1']").addEventListener('change', function() {

 if (file.files.length == 0) {
                    stat.value = "";
                    label.innerHTML = "";
                } else {
                    stat.value = "✔️";
                    label.innerHTML = "✔️";
                }
});

});

</script>

After that, hide the Status field using: https://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-hide-fields-in-datapages/

Hope this helps!!

 

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