0

Dear All,
I have a form use for uploading photos to my website. But I would like users to fully filled in the selection only then the "Submit" or "Upload" button will be activated. How can I do this?

Below is my code:

<form name=Image enctype=multipart/form-data method=POST>
<table cellspacing=2 cellpadding=2 border=0>
<tr>
<td>Image 1: </td>
<td><input type=file name=file accept=image/gif, image/jpeg, image/x-ms-bmp, image/x-png size=26 class=textbox />
</td>
</tr>

<tr>
<td>Image 2: </td>
<td><input type=file name=file1 accept=image/gif, image/jpeg, image/x-ms-bmp, image/x-png size=26 class=textbox />
</td>
</tr>

<tr>
<td>Image 3: </td>
<td><input type=file name=file2 accept=image/gif, image/jpeg, image/x-ms-bmp, image/x-png size=26 class=textbox />
</td>
</tr>

<tr><td> </td><td><input type=submit name=submit value=Upload class=button /></td></tr></table>
</form><br>

Thanks for any help.

2
Contributors
1
Reply
7
Views
2 Years
Discussion Span
Last Post by hericles
1

You can use the 'required' html attribute by adding it to the necessary fields.
Or you can use a javascript function on the click event of the submit button to check all inputs and only if all pass validation does the function return true and let the submit continue.
Or you can still submit the form but use PHP code to check the passed parameters and either process the form or pass errors back to the page.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.