Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:19:31+00:00 2026-06-10T19:19:31+00:00

Obviously this isn’t the final form, but a snippet I created to debug the

  • 0

Obviously this isn’t the final form, but a snippet I created to debug the form. It still has the same error as the final form. I’ve been working on this one for hours.

No other javascript in any other html form on my client localhost does this. This is in a MAMP environemnt on a MAC.

It’s just here and I can’t get fix it to save my a**. Advice most welcome at this point. It’s got to be something simple. I’ve tried all the hard stuff and it has no effect on the outcome.

html file contents

<!DOCTYPE html>
  <head>
    <meta charset="utf-8" />
    <title>NCSA Contact Form</title>
  </head>

  <body>
    <form action="test.js" name="frmNcsa" id="frmNcsa" method="post">
       <input type="submit" name="submitData" id="submitData" value="Submit"/>

    </form>

    <script type="text/javascript" src="test.js"></script>

  </body>
</html>

test.js file contents

    var $ = function(id){
      document.getElementById(id)
    }

    function prepareEventHandlers() {
      alert("This is test.js")
    }

    window.onload =  function () {
      prepareEventHandlers();
    }

Firefox Error Message

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

After Page Reloads

What I see in the browser after clicking the form submit button
Page reloads, submit button gone. The JS file is read into the browser as text

var $ = function(id){
    document.getElementById(id)
}

function prepareEventHandlers() {
    alert("This is test.js")
}

window.onload =  function () {
    prepareEventHandlers();  
}

What should clicking submit do?

An alert dialog box that says “This is a test”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:19:33+00:00Added an answer on June 10, 2026 at 7:19 pm

    By having action="test.js" in your form, you are telling browsers that the form should be submitted (posted) to test.js on the server, which doesn’t make much sense. Without knowing more about what you are actually trying to achieve, I can only assume that you want the form to be purely handled on the client side, in javascript? In this case, you do not need a form at all. You simply need a submit button with an action that calls your handler function when clicked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope this isn't too difficult, obviously you can call HTML tags such as
This is obviously a rookie question about Adobe technologies, but I am seeking a
I thought I had resolved this but I obviously haven't and was hoping someone
The web browser DOM has been around since the late '90s, but it remains
For some reason this isn't working, am I missing something obvious? RewriteRule ^(.*)infopopup.html$ /acatalog/infopopup.html
I'm fairly new to servlets so I hope this isn't an obvious question. So
I'm trying to scrape this grid from a website: Obviously this is going to
I have a database entry that I need to update. This method obviously doesn't
This one is quite obviously a function pointer : typedef int (* foobar) (int
Obviously it's early days, I do not know whether this is information that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.