Jump to content

<input type="image"> not listening to javascript!


michaellunsford

Recommended Posts

When I submit an empty search field, I get the error popup, but the stupid thing submits anyway. Could alert() be returning true when I click okay?


[code]<form action="search.html" method="post" id="quick_search" onsubmit="submit_check();";>
<input name="quick_search" type="text" class="textfield" onfocus="smarter_field()" onblur="smarter_field()" size="16" />
<input type="image" id="quick_search_06" src="/images/quick_search_06.jpg" onmouseover="this.src='/images/quick_search_a_06.jpg'" onmouseout="this.src='/images/quick_search_06.jpg'" />
</form>[/code]

[code]
function submit_check() {
mml=document.forms['quick_search'].elements['quick_search'];
if(mml.value=='') {
alert('Please enter a value');
return false;
} else return true;
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34292-not-listening-to-javascript/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.