netpicker9
11-30-2006, 08:41 AM
First.aspx:
<Form id="aspForm" runat="server" action="Second.aspx">
'Lot of Other stuff here..
'Buttons Bar
<asp:Button ID="cmdGo" runat="server" Text="Continue >>"/>
<asp:Button ID="cmdPrint" runat="server" Text="Print Me" OnClientClick="javascript:PF1();"/>
<input name="cmdCalc" type="Submit" value="Calculate" onclick="return MeCalc();">
<input type="hidden" name="intMax" value="">
<input type="hidden" name="intMin" value="">
</Form>
When I click cmdGo, it will take me to Second.aspx
Problems I am facing:
1.
When I click cmdCalc (for this I am using normal HTML Submit button), I want to call Third.aspx.
In this button I am calling a JavaScript Function MeCalc(), MeCalc has lot of things to do and it will return some values to Hidden Fields,
These hidden field values I want to take to Third.aspx
User has to select one of Radio buttons (are created dynamically) in the form before submitting to Third.aspx, I wrote validation for radio button and displaying an alert, but after pressing OK in alertbox,
the form is submitting onto it self.. i.e to First.aspx.
and If I select radio button and then click Submit.. the for still submitting to the same page, but not going to Third.aspx
function RadioB(){
var theMain = document.forms['aspForm'];
if (!theMain) {
theMain = document.aspForm;
}
var numarr = "";
var option = -1
var i
var liCount = <% Response.write(mtn) %>
for (i=0; i< theMain.txtSelect.length; i++) {
if (theMain.txtSelect[i].checked) {
option = i;
}
}
if (option == -1) {
alert ("Please select radio button before Calculate");
return false;
}
theModel.intMax.value = eval("theMain.txtMax" + row + ".value")
theModel.intMin.value = eval("theMain.txtMin" + row + ".value")
return true;
}
function MeCalc(){
if(RadioB()){
document.location="Third.aspx?NUM=<% response.write(sID)%>";
}else{
}
}
Where I am doing Mistake here?? Please guide me.
--------------------------------------------------------------------------
2.
When I click cmdPrint, I am calling JavaScript function PF1(), its opening an another page in
new window, But still the parent form (First.aspx) is submitting onto it self, How to Avoid that?
function PF1(){
var lsURL = document.location.href;
if (lsURL.indexOf('?') < 0){
lsURL = lsURL + "?pf=1&NUM=<% response.write(sID)%>";
}
lsURL = lsURL.replace(/\.aspx/i, "P.aspx")
window.open(lsURL, "_blank", "location=no,top=0,left=0,menubar=yes,toolbar=no,scrollbars=yes,height= 500,width=820");
}
Thanks
<Form id="aspForm" runat="server" action="Second.aspx">
'Lot of Other stuff here..
'Buttons Bar
<asp:Button ID="cmdGo" runat="server" Text="Continue >>"/>
<asp:Button ID="cmdPrint" runat="server" Text="Print Me" OnClientClick="javascript:PF1();"/>
<input name="cmdCalc" type="Submit" value="Calculate" onclick="return MeCalc();">
<input type="hidden" name="intMax" value="">
<input type="hidden" name="intMin" value="">
</Form>
When I click cmdGo, it will take me to Second.aspx
Problems I am facing:
1.
When I click cmdCalc (for this I am using normal HTML Submit button), I want to call Third.aspx.
In this button I am calling a JavaScript Function MeCalc(), MeCalc has lot of things to do and it will return some values to Hidden Fields,
These hidden field values I want to take to Third.aspx
User has to select one of Radio buttons (are created dynamically) in the form before submitting to Third.aspx, I wrote validation for radio button and displaying an alert, but after pressing OK in alertbox,
the form is submitting onto it self.. i.e to First.aspx.
and If I select radio button and then click Submit.. the for still submitting to the same page, but not going to Third.aspx
function RadioB(){
var theMain = document.forms['aspForm'];
if (!theMain) {
theMain = document.aspForm;
}
var numarr = "";
var option = -1
var i
var liCount = <% Response.write(mtn) %>
for (i=0; i< theMain.txtSelect.length; i++) {
if (theMain.txtSelect[i].checked) {
option = i;
}
}
if (option == -1) {
alert ("Please select radio button before Calculate");
return false;
}
theModel.intMax.value = eval("theMain.txtMax" + row + ".value")
theModel.intMin.value = eval("theMain.txtMin" + row + ".value")
return true;
}
function MeCalc(){
if(RadioB()){
document.location="Third.aspx?NUM=<% response.write(sID)%>";
}else{
}
}
Where I am doing Mistake here?? Please guide me.
--------------------------------------------------------------------------
2.
When I click cmdPrint, I am calling JavaScript function PF1(), its opening an another page in
new window, But still the parent form (First.aspx) is submitting onto it self, How to Avoid that?
function PF1(){
var lsURL = document.location.href;
if (lsURL.indexOf('?') < 0){
lsURL = lsURL + "?pf=1&NUM=<% response.write(sID)%>";
}
lsURL = lsURL.replace(/\.aspx/i, "P.aspx")
window.open(lsURL, "_blank", "location=no,top=0,left=0,menubar=yes,toolbar=no,scrollbars=yes,height= 500,width=820");
}
Thanks