Page 1 of 1

HTML Object error

Posted: Mon May 15, 2023 8:04 pm
by treed
I have a simple form with an html object that retrieves a file.

Code: Select all

  <!-- HTML5 Input Form Elements -->
  <p>Click on the "Choose File" button to upload a file:</p>
  <input id="fileupload" type="file" name="fileupload"> 
  <button id="upload-button" onclick="uploadFile()"> Upload </button>

  <!-- Ajax JavaScript File Upload Logic -->
  <script>
  async function uploadFile() {
  let formData = new FormData(); 
  formData.append("file", fileupload.files[0]);
  await fetch('libs/upload/upload1.php', {
    method: "POST", 
    body: formData
  }); 
  alert('The file has been uploaded successfully.');
  }
  </script>
This code works perfectly when the form is opened from the magnifing glass in the form builder module. However when opening it from a launch menu button I get this error
Screenshot from 2023-05-15 11-02-16.png

Re: HTML Object error

Posted: Tue May 16, 2023 12:46 am
by treed
Ok, figured it out. I was trying to open in an edit form and should have been using a launch form since I didn't really need to edit a record. For future reference, if I want to make an edit form how is one opened to a specific record?

Re: HTML Object error

Posted: Tue May 16, 2023 7:38 am
by kev1n
I tried to reproduce the error by placing an HTML object with your code on a form. However, I did not receive an error when opening the form. Could it be that another code is causing the problem?

To open a specific record in an edit form, you can add the record ID to the "Record ID" field of the Run object.

Re: HTML Object error

Posted: Tue May 16, 2023 6:34 pm
by treed
There was just this one html object on the form. Simply changing from edit to launch worked.