Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dumb Question - Important Reason

Status
Not open for further replies.

CharlieMike73

Programmer
May 17, 2002
120
US
Hi, I know this has been done many times, but i am comming up short to find the code...

What I need is the code to check if a value has been supplied, and will prompt a user to enter some data (the date in this case), if it has not already been.

This is to be used on a VBScript ASP page and the date's (starting and ending dates) will be put into the SQL statement that will populate the page.

I would ideally like it is the user was prompted by a popup window that asks for the start date and ending date.

Does anybody know where i can get the code for this, or does anybody have anything like this that i could use, please.

Thank You,
Charlie
 
try
Dim Input1, Input2, theDate1, theDate2
theDate1 = [value from somewhere]
theDate2 = [value from somewhere]
If theDate1 = "" then
Input1 = InputBox("Enter a beginning date please!")
if Input1 = "" then
MsgBox ("You must enter a beginning date!)
end if
end if

If theDate2 = "" then
Input2 = InputBox("Enter a ending date please!")
if Input2 = "" then
MsgBox ("You must enter a beginning date!)
end if
end if

now you have the variable Input1 and Input2 to do with as you will if the first variables were not met

hope that helps [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
that is is you can use vbscript client side. here is what you want to do if you have the possibility of NS browsers viewing the pages

<script language=&quot;javascript&quot;>
function getDates()
{
var name = prompt(&quot;Please enter your name&quot;,&quot;&quot;)
if (name != null && name != &quot;&quot;)
{
alert(&quot;Please enter a date&quot;)
}
//then save the dates to a hidden form field to pass to the
//asp pages
{
document.form1.hidden1.value = name
}
</script>
<body onLoad=&quot;getDates()&quot;>
<form name=form1 method=&quot;get&quot;>
<input type=&quot;hidden&quot; name=&quot;hidden1&quot; value=&quot;&quot;>
</form>

when you call it in the asp page do
dim theDate1 = Request.QueryString(&quot;hidden1&quot;)

now you have a variable from the html page to be used in your asp page


hope that helps
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
apologies
I forgot to mention the second way you will need to submit somehow
either onunload or a submit button etc.. use your imagination[lol]

[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Yes, this is for a specific audiance that uses IE, so the VB versio should be fine. If anyone is using any other Browser, then they are doing so again company policy - Says me - LoL

Thank you for you help, I will give it a try tomorrow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top