[FX.php List] Problems w/ Internet Explorer 7 (submit via image)

Joel Shapiro jsfmp at earthlink.net
Wed Feb 14 18:21:40 MST 2007


Hi all

I wanted to share something that bit me.  Maybe it'll be helpful for  
someone else here.

I just discovered a situation where submitting a form via an image (a  
graphic 'button') doesn't work in Internet Explorer 7 (Windows) even  
though it works fine in Firefox (both Win & Mac), Safari, IE 5 Mac,  
and I *think* IE6 Win, but can no longer test that since 7 overwrote 6.

I've got a form where the submit button first checks JavaScript  
validation and then proceeds to process.  I recently switched the  
submit button to a graphic image, and that seems to have caused the  
problem.  I don't claim that my code is perfect,  but IE7 (only) was  
not passing the name of the form &/or was not passing a hidden value  
with the POST -- until I switched back to input type="submit".

I haven't tested all permutations of this, so I don't know if it's  
the only thing going on, but I do know that the switch back fixed the  
problem.  I did a quick google search for relevant IE7 problems and  
found some with "<button>" but don't know if  that's relevant.  If I  
ever do more testing, I'll report back here.


// the following did not work in IE7, although it works in other  
browsers
<input type="image" name="application"  value="submit" src="images/ 
submit.gif">

// but this seems to work fine in all browsers:
<input type="submit" name="application" value="submit">

// here's the form
echo '<form method="post" action="application.php" name="form"  
onsubmit="return validateForm(this)">
	<input type="hidden" name="app_pid" value="'.$pid.'">';


// In my processing, I have:
if( $_POST['application'] == 'submit' ) {
	$pid = $_POST['app_pid'];
	// process here
} else {
	// error
}


In IE7, I was always getting the error w/ the image submit, but when  
I changed back to the input type="submit", it worked fine.


// FYI- In my javascript validation I have:
function validateForm()    {
if (document.form.NameFirst.value == "") {
	alert("Please provide a First Name.");
	document. form.NameFirst.focus();
	return false;
	}
// (etc.)



On a side note, IE7 also had a couple oddities in displaying text.   
On one page, I have some text in a <div> box.  The last letter of  
that text showed both in the original text, and also by itself just  
outside the <div> box.  It was indeed the same letter twice, as  
highlighting one of them in the browser highlighted the other at the  
same time.  Odd...

-Joel


Joel Shapiro - FileMaker Pro Database Design
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
joelshapiro at jsfmp dot com
http://www.jsfmp.com
415-269-5055




More information about the FX.php_List mailing list