Disable submit button after submitting

The following code adds a JavaScript action to a submit button that will disable the button after submitting.

using System.IO;

using TallComponents.PDF;
using TallComponents.PDF.Actions;
using TallComponents.PDF.Forms.Fields;
using TallComponents.PDF.JavaScript;

namespace DisableSubmitButton
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = @"..\..\submit-button.pdf";

            using (FileStream fileIn = File.OpenRead(path))
            {
                Document document = new Document(fileIn);

                string name = "Submit";
                PushButtonField button = document.Fields[name] as PushButtonField;
                button.Widgets[0].MouseUpActions.Add(new JavaScriptAction {
                    JavaScript = new JavaScript($"this.getField('{name}').readonly = true;")
                });

                using (FileStream fileOut = File.OpenWrite(@"..\..\disable-submit-button.pdf"))
                {
                    document.Write(fileOut);
                }
            }
        }
    }
}