Issue 98: Submit form with image rather than button
Status:  Fixed
Owner: ----
Closed:  Oct 2008
Reported by John.D.S...@gmail.com, Oct 19, 2008
I have a form that opens a modal just fun but if i try to use

<a href="#"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage
('btnSearch','','../images/search_on.png',1)" 
onclick="document.frmSearch.submit() 
" id="click" class="nyroModal"><img src="../images/search_off.png" 
alt="Submit" name="btnSearch" width="64" height="19" border="0" 
id="btnSearch" /></a>

The form doesnt open in a modal, it opens in the page. I tried a few 
different manual calls based on some other issues on this site but can't 
get anything to work.

Any ideas?

Thanks,
John
Oct 20, 2008
Project Member #1 nyro...@gmail.com
Try with using the <input type="image" first, it could be better.
Then you could add your rollover state with jQuery using the hover function for example.

Otherwise, if you prefer use your code, you could simply remove the onlick and the
class attribute of your anchor.
Add an id="frmSearch" to your form.
Finally:
$(function() {
	$('#click').click(function(e) {
		e.preventDefault();
		$('#frmSearch').submit();
	});
});
Status: Fixed
Labels: -Type-Defect Type-Other
Oct 20, 2008
#2 John.D.S...@gmail.com
I just kept my rollover and followed your instructions to use:
$(function() {
	$('#click').click(function(e) {
		e.preventDefault();
		$('#frmSearch').submit();
	});
});


everything works great! 

Thanks for the quick response!