I have a form with an input type=image. It used to have a confirm in its onclick that returned true/false allowing/stopping the form submit. I've recently 'upgraded' to a non-modal dialog with a callback handler.
Since the callback handler is non-modal, the return value to the input is always false, don't submit... When I submit upon confirmation, the name of the input is not on the form, since it technically wasn't clicked. This is the problem, the code is looking for the input to be on...
I can use a hidden field with the old name and set it to on to bypass that issue, but that seems cludgy. What would be nice, is if I could 'turn the input on' without triggering the onclick (a recursive disaster). Maybe not a disaster, but not sexy. I've tried to set the value of the input to on, but it doesn't seem post.
Any ideas? P.S. I am not using .NET, so solutions involving ASP.NET won't apply :-(
I am adding example code. When clicking Foo!, you'll notice that Foo.x=0 and Foo.y=0 in the address bar. Clicking bar, you get nothing. I'd like to be able to place bar on the form inside the BarCallback.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script language="javascript" type="text/javascript">
function Bar() {
setTimeout(BarCallback, 500);
return false;
}
function BarCallback() {
document.getElementById('TheForm').submit();
}
</script>
</head>
<body>
<form method="get" id="TheForm">
<input type="image" alt="Foo!" name="Foo" />
<br />
<input type="image" alt="Bar!" name="Bar" onclick="return Bar();" />
</form>
</body>
</html>