MJ
asked on
Submit a form action to new target ???
I have a function that sets hiddden fields in a form and submits it. The thing is I want to have the page it submits to come up in a separate window , not the same window. How do I do this???
//////////////////////////
Code sample
/////////////////////////
function submitForm(event, action, cValue, courseName){
document.catalog.eventType .value = event;
document.catalog.actionTyp e.value = action;
document.catalog.cValue.va lue = cValue;
document.catalog.courseNam e.value = courseName;
document.catalog.submit();
return false;
}
// End hiding script from old browsers -->
</script>
<br>
<div class="PageTitle">Brocade Course Catalog</div>
<br>
<FORM NAME='catalog' METHOD='POST' ACTION='http://www.brocade.com/gtms/education_services'>
<INPUT TYPE = 'HIDDEN' NAME = 'eventType' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'actionType' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'cValue' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'cValue1' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'courseName' VALUE = ''>
//////////////////////////
Code sample
/////////////////////////
function submitForm(event, action, cValue, courseName){
document.catalog.eventType
document.catalog.actionTyp
document.catalog.cValue.va
document.catalog.courseNam
document.catalog.submit();
return false;
}
// End hiding script from old browsers -->
</script>
<br>
<div class="PageTitle">Brocade Course Catalog</div>
<br>
<FORM NAME='catalog' METHOD='POST' ACTION='http://www.brocade.com/gtms/education_services'>
<INPUT TYPE = 'HIDDEN' NAME = 'eventType' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'actionType' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'cValue' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'cValue1' VALUE = ''>
<INPUT TYPE = 'HIDDEN' NAME = 'courseName' VALUE = ''>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For some reason the target="_new" in the page works but the submitting page reloads and I get an error (jsp page). I tried both methods and the both launch a new window fine but the page with the form submission code reload? I can't have this!
ASKER
I fixed it! It was because I had the funtion returning false. I just removed it!
Thanks for the points.
<script>
window.name = "myWin";
</script>
So you can target to that window:
document.catalog.target = "myWin";
document.catalog.submit();
return false;
}
Or you open a new window and give it a name like this:
newWin = window.open("", "myWin", "height=100,width=100");
document.catalog.target = "myWin";
document.catalog.submit();
return false;
}