 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
pearsont74
Joined: 13 Mar 2008 Posts: 2
|
Posted: Thu Mar 13, 2008 12:41 pm open a new window in form with an action |
|
|
|
ok...i searched and found javascrtiping to open a new window onclick event but my form does a get with an action to an aspx page and if i add the open.window infront of this action it doesnt work and if i add the open.window in a onclick event is opens 2 windows
| Code: |
<form name="Form1" method="get" action="../lookup2/phydatagrid.aspx?tablename=physicians" onsubmit="return validateZIP(this.zipcode.value, this.radius.value, this.name)" target="_blank">
|
can this be done? |
|
ogsolution
Joined: 26 Dec 2007 Posts: 144
|
Posted: Thu Mar 13, 2008 10:37 pm |
|
|
|
Try it this way...
| Code: |
<html>
<head>
<script type="text/javascript">
function validateZIP(){
//Do the validation
//If everything validates, open window
window.open("../lookup2/phydatagrid.aspx?tablename=physicians");
return false; //very important that you return false!!!
}
</script>
</head>
<body>
<form name="Form1" action="" onsubmit="return validateZIP(this.zipcode.value, this.radius.value, this.name);">
<input type="submit" value="Submit">
</form>
</body>
</html> |
Since you are using a GET, you don't necessarily need to do a real submit. Instead, you can just do window open in your javasript function.
Remember, return false is VERY IMPORTANT in this and be sure to have return in the onsubmit as well. Or else, it'll do a submit when the validate function finishes running. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|