在使用javascript控制后,使用appengine python提交文件

在使用javascript控制后,使用appengine python提交文件,javascript,forms,google-app-engine,python-2.7,jinja2,Javascript,Forms,Google App Engine,Python 2.7,Jinja2,我正在尝试对输入文件进行简单检查。通过表单发送,使用Javascript,在Python运行时使用App Engine,并使用Jinja2。表格如下: <form action="{{ upload_url|safe }}" name="inputfile" id="inputfile" method="post" enctype="multipart/form-data"> Load a file: <input type="file" id="file" n

我正在尝试对输入文件进行简单检查。通过表单发送,使用Javascript,在Python运行时使用App Engine,并使用Jinja2。表格如下:

<form action="{{ upload_url|safe }}" name="inputfile" id="inputfile" method="post" enctype="multipart/form-data">
    Load a file:
    <input type="file" id="file" name="file"><br>
    <input type="button" name="submit" value="Send" onclick="checkForm()">
</form></br>
当我尝试提交not文件或not txt文件时,警报消息没有问题。但当一切正常时,函数不会提交文件。 如果我使用提交输入,而不是按钮,则文件将毫无问题地发送。
有人知道出了什么问题吗?

我想是输入名称导致了这个问题。我尝试了没有名字属性的代码,它成功了。 您可以在删除名称字段后尝试代码吗


它无论如何都不起作用。现在我在主处理程序中进行检查,但我不明白为什么它不能以这种方式工作!
function checkForm(){
var message ="";

if(!document.inputfile.file.value) message += "You must select a file\n";
if(document.inputfile.file.value && !(estensione(document.inputfile.file.value))) message += "The extension of the file MUST be .txt\n";

if(message != "" ) alert(message);
else document.inputfile.submit();   
}