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 7846053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:27:01+00:00 2026-06-02T17:27:01+00:00

I have the following form: <form id=vintro-upload-form action={url}?nexturl={nextUrl} method=post enctype=multipart/form-data > <input name=file type=file/>

  • 0

I have the following form:

<form id="vintro-upload-form" action="{url}?nexturl={nextUrl}" method="post" enctype="multipart/form-data" >
<input name="file" type="file"/>
<input name="token" type="hidden" value=""/>
<input value="Upload Video File" type="button" name="submit" onClick="checkFile()" class="button" />
</form>

and the following javascript:

<script>
function checkFile(){
 var fileVal = document.forms["vintro-upload-form"].elements['file'].value;
 //RegEx for valid file name and extensions.
 if(fileVal != ""){vintro-upload-form.submit();} 
 else {alert('Please select the Video file.');}
}
</script>

What works? The fileVal assignment is good. Submit isn’t working, when I checked the debugger, it is saying: “vintro is undefined.”

What have I tried?
The following examples and code:

  • http://www.w3schools.com/jsref/met_form_submit.asp
  • http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
  • document.vintro-upload-form.submit();
  • document.forms[“vintro-upload-form”].submit();
  • document.getElementById(“vintro-upload-form”).submit();
  • changed the dashes/hyphens to underscores

All to no success. There is some jQuery (in another .js file) going on with this form as well, and it functions properly with the hyphenated name.

Why is the submit call not working?

EDIT:
I have tried using document.getElementById('vintro-upload-form').submit(); as suggested in the answers to this question, however, this is still failing. My (Firefox) debugger is saying that it is not a function. Chrome’s debugger explained a little bit more: “Uncaught TypeError: Property ‘submit’ of object # is not a function” (I’m going to Google this in the meantime.)

Since I have less than 100 reputation:
Ok, so it turns out, I was asking the wrong question.

Here’s the answer I found:
Submitting Form Via Javascript, form defined in external PHP file

Check the accepted answer as well.

  • 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-02T17:27:02+00:00Added an answer on June 2, 2026 at 5:27 pm

    This JavaScript:

    document.forms["vintro-upload-form"].elements['file'].value

    is looking for the NAME attribute of the form tag:

    document.forms[{form_name}].elements[{field_name}].value

    You just have an ID. Copy the value of the ID to a NAME and you’re done.

    However, document.getElementById() is the preferred, modern way of doing this with plain JavaScript.

    HOWEVER: You can’t have a submit / button named “submit”.

    When you do and you call the JavaScript submit() function, you get a conflict.

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

Sidebar

Related Questions

I have the following form <form id=file_upload action=/Upload/Save method=POST enctype=multipart/form-data> <input type=text id=txtProposalName name=name
I have the following form <form id=upload method=post EncType=Multipart/Form-Data action=reciver.aspx> <input type=file id=upload name=upload
I have the following form: <form enctype=multipart/form-data action=uploader.php method=POST> <input name=uploadedfile type=file /> </form>
I have the following form <form name=myForm id=myForm method=post enctype=multipart/form-data action=script.php> and this jQuery
I have the following form on an .NET MVC View: <form method=post enctype=multipart/form-data action=/Video/UploadDocument>
I have the following form setup: <html> <head></head> <body> <form method=post enctype=multipart/form-data action=FileUpload> <table>
I have the following form: <html> <body> <form action=upload_file.php method=post enctype=multipart/form-data> <label for=file>Filename:</label> <input
i have the following form <form action=ManageLink method=post> <input name=artistName type=text/> <input name=songName type=text/>
I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
I have a following form: <form action=doThis.php?warehouse=12 method=post> <input name=field1 type=text /> <input name=field2

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.