bearpaws
asked on
Using client-side and navigating with parameters
Hi folks,
I am still having a problem with my coding. Here's the problem. I have a page, page1, which is written in vbscript and accepts, validates and compares two dates that the user selects. I wnat to redirect them to the right page and pass the date values.
The problem that I am having is the only command I can get to work is the window.open
command and that leads to another can of worms.
On page 1, they select two dates and click on a button to choose whither they want a report or if they want a listing, ie "Report" or "Listing"
on the onclick event of each button, i have a routine which validates the two dates, and compares to ensure the ending date is greater than the beginning date. This routines are written in vbscript and work well etc. If the dates are valid, I want to pass the dates to the next page. The problem is window.location.href and the window navigate command simply won't work. It just sits in the same spot.
For the window.location.href = "page2.asp?bd=" & vbeg & "&ed=" & vend
I don't recieve any error message; the window progression bar appears to be doing something, but it just stays at the same window...
I have also tried this:
vstring= "page2.asp?bd=" & vbeg & "&ed=" & vend
window.location.href = vstring
what am I doing wrong? All I want to do is pass the valid dates to the next page.
any help would be appreciated...
I am still having a problem with my coding. Here's the problem. I have a page, page1, which is written in vbscript and accepts, validates and compares two dates that the user selects. I wnat to redirect them to the right page and pass the date values.
The problem that I am having is the only command I can get to work is the window.open
command and that leads to another can of worms.
On page 1, they select two dates and click on a button to choose whither they want a report or if they want a listing, ie "Report" or "Listing"
on the onclick event of each button, i have a routine which validates the two dates, and compares to ensure the ending date is greater than the beginning date. This routines are written in vbscript and work well etc. If the dates are valid, I want to pass the dates to the next page. The problem is window.location.href and the window navigate command simply won't work. It just sits in the same spot.
For the window.location.href = "page2.asp?bd=" & vbeg & "&ed=" & vend
I don't recieve any error message; the window progression bar appears to be doing something, but it just stays at the same window...
I have also tried this:
vstring= "page2.asp?bd=" & vbeg & "&ed=" & vend
window.location.href = vstring
what am I doing wrong? All I want to do is pass the valid dates to the next page.
any help would be appreciated...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
what about validating the dates and passing them to the next page??
<form name="test1" id="test1" method="get" action="page2.asp" onsubmit="validate">
Start Date:<input type="text" name="sdate"/>
End Date:<input type="text" name="edate"/>
<input type="submit" onClick="this.form.action=
<input type="submit" onClick="this.form.action=
<input type="submit" onClick="this.form.action=
<input type="submit" onClick="this.form.action=
<input type="submit" onClick="this.form.action=
</form>
the validation will still occur, the onClick does not override the onSubmit in the form, but your form will submit with invalidate dates unless you have it as
onSubmit="return validate" and your function returns true or false depending on the validation,
ASKER
Thank you both for responding. I came up with a solution which only took rewriting in javascript and one function to cover all redirections and I think it is pretty slick. What I did was create one rtn, passing a paramter to the function, do a bunch of validation and then depending on what parameter I passed, determined what page to redirect to.
But both of you helped to point the way and gave me food for thought. Therfore, I am splitting the points which I believe is fair. If not, let me know.
I thought I would share how I acheived my goal...
This statement was for setting up for button for email and a report
Both use same rtn, but pass a parameter indentfying where I want to go..
<tr><td>
<input type="image" onclick="CreateRtn('E');re turn false;" src="../images/Email.jpg" WIDTH="106" HEIGHT="35"></td></tr>
<tr><td>
<input type="image" onclick="CreateRtn('R');re turn false;" src="../images/Rpt.jpg" WIDTH="106" HEIGHT="35"></td></tr>
function CreateRtn(xtype)
{
/* validating checks blah blah...*/
/* redirect em*/
if (xtype == 'L')
{
window.location.href = 'SendLabels.asp?bd='+ vdate
}
if (xtype == 'R')
{
window.location.href = 'SendRpt.asp?bd='+ vdate
}
}
It works really well and solved a bunch of headaches..
thanks again :-)
But both of you helped to point the way and gave me food for thought. Therfore, I am splitting the points which I believe is fair. If not, let me know.
I thought I would share how I acheived my goal...
This statement was for setting up for button for email and a report
Both use same rtn, but pass a parameter indentfying where I want to go..
<tr><td>
<input type="image" onclick="CreateRtn('E');re
<tr><td>
<input type="image" onclick="CreateRtn('R');re
function CreateRtn(xtype)
{
/* validating checks blah blah...*/
/* redirect em*/
if (xtype == 'L')
{
window.location.href = 'SendLabels.asp?bd='+ vdate
}
if (xtype == 'R')
{
window.location.href = 'SendRpt.asp?bd='+ vdate
}
}
It works really well and solved a bunch of headaches..
thanks again :-)
ASKER
I do not like using the window.open command as it creates a pop-up window. I just want to redirect them to another page passing the values. I know how to do it quite well with server-side coding, but this has to be clinet-side coding and hence, the problem with getting to the correct next page based on what button they click on....