Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Image buttons submit!!

    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?
    Code:
    <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>

  • #2
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    What are you tring to do? Do you just want one button to submit?

  • #3
    Regular Coder slappyjaw's Avatar
    Join Date
    Mar 2009
    Location
    Wonderland!
    Posts
    146
    Thanks
    14
    Thanked 3 Times in 3 Posts
    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.
    Code:
    <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>

  • Users who have thanked slappyjaw for this post:

    bo2la (08-24-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •