Empty before File Upload

Source: Internet
Author: User

If the drop-down list box or file box is empty during file upload, an error is returned.
Here we will solve this problem.

Extract A test of the value in the drop-down box:
<Body>
Please provide the value of the drop-down box:
<Select name = "mychoise" onpropertychange = "A ()">
<Option selected> select </option>
<Option> 1 </option>
<Option> 3 </option>
<Option> 5 </option>
</SELECT>
<SCRIPT languange = "JavaScript">;
Function (){
Window. Confirm (document. All. mychoise. Options [document. All. mychoise. selectedindex]. Text );
}
</SCRIPT>
</Body>

The following is a specific list box:
<Select id = select1 name = machtype>
<Option value = "" selected> -- select the mobile phone model -- </option>
<%
DS = (Dataset) request. getattribute (enumconstant. machtype );
DS. First ();
Do {
%>
<Option value = <% = Ds. getstring ("mach_type") %> <% = Ds. getstring ("mobile_name") %> </option>
<%
}
While (Ds. Next ());
String S;
%>
</SELECT>

The following is a file control:
<Input name = "myfile" type = "file" size = "30">

The final result is judgment. If it is null, it will not be processed:
<Script language = JavaScript>
Function uploadfile (){
If (document. uploadform. myfile. value! = "") & (Document. uploadform. machtype. value! = "")){
Uploadform. Submit ();}
}
</SCRIPT>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.