...

View Full Version : Image buttons submit!!



bo2la
08-23-2010, 10:07 AM
I have a JSP with HTML and Javascript in it. There're 2 image buttons and 1 Submit button, for some reason ALL buttons submit (when I click any of the image buttons, it works fine but submits too). I'm kinda new to HTML and JS so i need to know where did I go wrong? :confused:

<form action="Req_Result" method="post" name="entry" onSubmit="return validate(this)">

<table border="0" cellpadding="10" cellspacing="10">
<tr>
<td>
<table>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchBy" checked="checked" value="byname" onclick="sortby()"> By Name</td>
</tr>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchBy" value="byDate" onclick="sortby()"> By Date</td>
</tr>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchType" checked="checked" value="whole" onClick="chMd()"> By Department</td>
</tr>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchType" value="byid" onClick="chMd()"> By ID</td>
<td><input name="ps" type="text" size="18" disabled="disabled"></td>
</tr>
<tr>
<td>Start Date:</td>
<td><input name="startdate" id="startdate" type="text" size="18" readonly>
<input type="image" src="theme/panelCalendarIcon.gif" value="date1" onClick="SelectDate()" ></td>
</tr>
<tr>
<td>End Date:</td>
<td><input name="enddate" id="enddate" type="text" size="18" readonly>
<input type="image" src="theme/panelCalendarIcon.gif" value="date2" onClick="SelectDate()" ></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>

slappyjaw
08-24-2010, 07:22 AM
What are you tring to do? Do you just want one button to submit?

slappyjaw
08-24-2010, 07:27 AM
Oh ok im sorry i see what you mean. You dont want the image buttons to submit the form. Well what you want to do is change those to regular images. So instead of the begining of the code block being an input, you want it to be and image. This might be the code your looking for.
<form action="Req_Result" method="post" name="entry" onSubmit="return validate(this)">

<table border="0" cellpadding="10" cellspacing="10">
<tr>
<td>
<table>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchBy" checked="checked" value="byname" onclick="sortby()"> By Name</td>
</tr>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchBy" value="byDate" onclick="sortby()"> By Date</td>
</tr>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchType" checked="checked" value="whole" onClick="chMd()"> By Department</td>
</tr>
<tr>
<td><INPUT TYPE="RADIO" NAME="searchType" value="byid" onClick="chMd()"> By ID</td>
<td><input name="ps" type="text" size="18" disabled="disabled"></td>
</tr>
<tr>
<td>Start Date:</td>
<td><input name="startdate" id="startdate" type="text" size="18" readonly>
<img src="theme/panelCalendarIcon.gif" onClick="SelectDate()" ></td>
</tr>
<tr>
<td>End Date:</td>
<td><input name="enddate" id="enddate" type="text" size="18" readonly>
<img src="theme/panelCalendarIcon.gif" onClick="SelectDate()" ></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum