---
title: "Hide the Create issue button until an attachment is added"
canonical: "https://support.appfire.com/space/PSJ/15482277/Hide%20the%20Create%20issue%20button%20until%20an%20attachment%20is%20added"
format: markdown
---
> Macro (aura-html)


# Problem

You want to hide the **Create issue** button until at least one attachment is added.

# Solution

To solve this problem, use [lfExecuteJS](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15480977) to watch the attachments module on the *Create screen*. If files are added as attachments, the **Create issue** button is displayed. Conversely, the **Create button** is hidden.

First, enter the following Live Fields script.

##### **livefields.sil**

```
lfExecuteJS("lf.js");
```

Next, create the** lf.js** file in the **silprograms** directory. Make sure the file has the following content:

##### **lf.js**

```
var attachments = AJS.$(".file-input-list ");
console.log("Got attachments");
AJS.$(function() {
  var $div = attachments;
  var html = $div.html();
  var checking = setInterval(function() {
    var newhtml = $div.html();
    if (html != newhtml) {
      myCallback();
      html = newhtml;
    }
  },100);
  function myCallback() {
    console.log("Content changed");
    var size = AJS.$("[duitype='dndattachment/progressbars/ProjectUploadProgressBar']").size();
    if (size == 0) {
        console.log("You can't create such an issue");
         AJS.$("#create-issue-submit").hide();
         AJS.$("#issue-create-submit").hide();
    } else {
        console.log("You can now create the issue");
        AJS.$("#create-issue-submit").show();
        AJS.$("#issue-create-submit").show();
    }
  }
});
```