Parsing Textbox Value Through Hyperlink

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a textbox for the user to enter a quantity and another
textbox for the delivery date. I disabled this delivery date textbox such
that the user has to press a calendar link next to the textbox, then a
calendar will pop up for him to choose the date. The dates that the user can
pick depends a lot on the quantity that he enters in the quantity field.

Is there any way that I can parse the quantity field to the calendar page
when the user press the calendar link? I am using a asp hyperlink, instead of
a button, because if I use a button, I'll have 2 buttons on the same form,
the calendar button and a submit button. As a result, (I don't understand
why), when the user click on the calendar button, the program will do some
client side verification for the data entered and the calendar will never
show. And I also don't know how to let the calendar page to pop out by
initiating from a button.

Can someone help me? Thank you.
 
Hi,

How have you implemented the popup calendar page? Is it an .aspx page or
just a plain HTML file with DHTML/JS calendar? In the former case, you can
use query string to pass the quantity value to the aspx page like this:

// Assuming txtQty is the name/ID of the Quantity text box
<a href="#' onclick="window.open('popup.aspx?qty=' +
document.all['txtQty'].value);">Show Calendar</a>

Use Request.QuertString["qty"] in the popup.aspx to grap the quantity.

If you use a static HTML, use opener.document.all['txtQty'].value in the
popup window to get the quantity value.

Hope this helps?
 
Thank you.

This is how i did it, i have a javascript for popping up the calendar.

function popupcal(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=300,height=350, top=0, left=0,
scrollbars=yes,resizable=yes');
return false;
}

I have a hyperlink, <asp:HyperLink id="hlCal" onclick="return popupcal(this,
'calendar')" runat="server"></asp:HyperLink>, that's for the calendar.

In part of my .aspx codes, I defined the hyperlink's navigate url as,
hlCal.NavigateUrl = "calendar.aspx?comp=" + RealComp +
"&FormName=fmAdd&CtrlName=txtDate&qty="

I tried hlCal.NavigateUrl = "calendar.aspx?comp=" + RealComp +
"&FormName=fmAdd&CtrlName=txtDate&qty=document.all['txtQty'].value);" but it
doesn't work. What can I do?

Siva M said:
Hi,

How have you implemented the popup calendar page? Is it an .aspx page or
just a plain HTML file with DHTML/JS calendar? In the former case, you can
use query string to pass the quantity value to the aspx page like this:

// Assuming txtQty is the name/ID of the Quantity text box
<a href="#' onclick="window.open('popup.aspx?qty=' +
document.all['txtQty'].value);">Show Calendar</a>

Use Request.QuertString["qty"] in the popup.aspx to grap the quantity.

If you use a static HTML, use opener.document.all['txtQty'].value in the
popup window to get the quantity value.

Hope this helps?


wrytat said:
I have a form with a textbox for the user to enter a quantity and another
textbox for the delivery date. I disabled this delivery date textbox such
that the user has to press a calendar link next to the textbox, then a
calendar will pop up for him to choose the date. The dates that the user can
pick depends a lot on the quantity that he enters in the quantity field.

Is there any way that I can parse the quantity field to the calendar page
when the user press the calendar link? I am using a asp hyperlink, instead of
a button, because if I use a button, I'll have 2 buttons on the same form,
the calendar button and a submit button. As a result, (I don't understand
why), when the user click on the calendar button, the program will do some
client side verification for the data entered and the calendar will never
show. And I also don't know how to let the calendar page to pop out by
initiating from a button.

Can someone help me? Thank you.
 
Just to add on,

I need to get the Request Quantity in the popup calendar for the PageLoad
and DayRender codes, to determine which dates can be selected and which
cannot. My calendar is an <asp:Calendar>

Thank you.

wrytat said:
Thank you.

This is how i did it, i have a javascript for popping up the calendar.

function popupcal(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=300,height=350, top=0, left=0,
scrollbars=yes,resizable=yes');
return false;
}

I have a hyperlink, <asp:HyperLink id="hlCal" onclick="return popupcal(this,
'calendar')" runat="server"></asp:HyperLink>, that's for the calendar.

In part of my .aspx codes, I defined the hyperlink's navigate url as,
hlCal.NavigateUrl = "calendar.aspx?comp=" + RealComp +
"&FormName=fmAdd&CtrlName=txtDate&qty="

I tried hlCal.NavigateUrl = "calendar.aspx?comp=" + RealComp +
"&FormName=fmAdd&CtrlName=txtDate&qty=document.all['txtQty'].value);" but it
doesn't work. What can I do?

Siva M said:
Hi,

How have you implemented the popup calendar page? Is it an .aspx page or
just a plain HTML file with DHTML/JS calendar? In the former case, you can
use query string to pass the quantity value to the aspx page like this:

// Assuming txtQty is the name/ID of the Quantity text box
<a href="#' onclick="window.open('popup.aspx?qty=' +
document.all['txtQty'].value);">Show Calendar</a>

Use Request.QuertString["qty"] in the popup.aspx to grap the quantity.

If you use a static HTML, use opener.document.all['txtQty'].value in the
popup window to get the quantity value.

Hope this helps?


wrytat said:
I have a form with a textbox for the user to enter a quantity and another
textbox for the delivery date. I disabled this delivery date textbox such
that the user has to press a calendar link next to the textbox, then a
calendar will pop up for him to choose the date. The dates that the user can
pick depends a lot on the quantity that he enters in the quantity field.

Is there any way that I can parse the quantity field to the calendar page
when the user press the calendar link? I am using a asp hyperlink, instead of
a button, because if I use a button, I'll have 2 buttons on the same form,
the calendar button and a submit button. As a result, (I don't understand
why), when the user click on the calendar button, the program will do some
client side verification for the data entered and the calendar will never
show. And I also don't know how to let the calendar page to pop out by
initiating from a button.

Can someone help me? Thank you.
 
In the JS funtion popupcal(), have

href = "calendar.aspx?Qty=" + document.all['<%= txtQty.ClientID %>'].value;
// Append more query strings if required

before calling window.open(). You can then fetch the quantity as
Request.QueryString["txtQty"] (C#) in calendar.aspx (Page load and other
subsequent methods) should get you the quantity text box value.

No need to set NavigateUrl in the code-behind.


Thank you.

This is how i did it, i have a javascript for popping up the calendar.

function popupcal(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=300,height=350, top=0, left=0,
scrollbars=yes,resizable=yes');
return false;
}

I have a hyperlink, <asp:HyperLink id="hlCal" onclick="return popupcal(this,
'calendar')" runat="server"></asp:HyperLink>, that's for the calendar.

In part of my .aspx codes, I defined the hyperlink's navigate url as,
hlCal.NavigateUrl = "calendar.aspx?comp=" + RealComp +
"&FormName=fmAdd&CtrlName=txtDate&qty="

I tried hlCal.NavigateUrl = "calendar.aspx?comp=" + RealComp +
"&FormName=fmAdd&CtrlName=txtDate&qty=document.all['txtQty'].value);" but it
doesn't work. What can I do?

Siva M said:
Hi,

How have you implemented the popup calendar page? Is it an .aspx page or
just a plain HTML file with DHTML/JS calendar? In the former case, you can
use query string to pass the quantity value to the aspx page like this:

// Assuming txtQty is the name/ID of the Quantity text box
<a href="#' onclick="window.open('popup.aspx?qty=' +
document.all['txtQty'].value);">Show Calendar</a>

Use Request.QuertString["qty"] in the popup.aspx to grap the quantity.

If you use a static HTML, use opener.document.all['txtQty'].value in the
popup window to get the quantity value.

Hope this helps?


wrytat said:
I have a form with a textbox for the user to enter a quantity and
another
textbox for the delivery date. I disabled this delivery date textbox
such
that the user has to press a calendar link next to the textbox, then a
calendar will pop up for him to choose the date. The dates that the user
can
pick depends a lot on the quantity that he enters in the quantity field.

Is there any way that I can parse the quantity field to the calendar
page
when the user press the calendar link? I am using a asp hyperlink,
instead of
a button, because if I use a button, I'll have 2 buttons on the same
form,
the calendar button and a submit button. As a result, (I don't
understand
why), when the user click on the calendar button, the program will do
some
client side verification for the data entered and the calendar will
never
show. And I also don't know how to let the calendar page to pop out by
initiating from a button.

Can someone help me? Thank you.
 
Back
Top