Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 6th, 2003, 06:04 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Auto update of text box/label

Dear Sir/Madam,

I have an ongoing issue with my ASP application. I am developing a Intranet site to enable employees to enter their holiday dates. When they enter the holiday dates I want to have a label or text box which updates with the number of days holiday they are requiring to book. Is this possible to do? Could you point me in the right direction. I am new to ASP and don't really know where to start.

Thanks in advance.


Regards,

Simon Dilley.
Reply With Quote
  #2 (permalink)  
Old June 6th, 2003, 07:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you want to do it entirely in ASP, you'll need to post the dates to the server then calculate the number of days and re-display the page including the calculated value and the original inputs.

Alternatively you could use a bit of javascript (or maybe even vbscript if your in an IE only intranet scenario) on the client-side which reads the input values, calculates the days and displays the result on the page without having to go to the server and back. Here's a quick 'n' dirty example which shows how to get values from input boxes and write to the page in client-side vbs.

<html>
<head>
<script language="VBScript">
Sub CalcDays()
    Dim dtStart, dtEnd, nDiff, sMsg

    dtStart = document.frmDate.txtStart.value
    dtEnd = document.frmDate.txtEnd.value

    If IsDate(dtStart) and IsDate(dtEnd) Then
        nDiff = 1 + DateDiff("d", dtStart, dtEnd)
        sMsg = nDiff & " days"
    Else
        sMsg = "valid dates only"
    End If

    document.getElementById("dvMsg").innerHTML = sMsg
End Sub
</script>
</head>
<body>
<form name="frmDate" id="frmDate">
Start Date : <input type="text" name="txtStart" id="txtStart"><br>
End Date : <input type="text" name="txtEnd" id="txtEnd"><br>
<div id="dvMsg"> </div><br>
<input type="button" value="Get Days" onclick="CalcDays">
</form>
</body>
</html>

hth
Phil
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Text in Label funnylearning .NET Framework 2.0 2 September 18th, 2006 12:59 PM
Auto-Filling a Text box based on Multiple Boxes zuldan23 Access VBA 1 May 5th, 2006 10:17 AM
Unattach Label from Text Box sweet4511 Access VBA 4 July 20th, 2005 11:20 AM



All times are GMT -4. The time now is 04:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.