Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 20th, 2006, 10:24 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default pass value to the hidden field

Can someone help me with this? there are 3 date fields:
day-month-year
. I want to pass the written three values into the hidden field. Example: 20-12-2006

Can you help me out? Do I have to set a function or can I do it with response.write or something ?


<input type="text" name="txtDD" id="datumDD" size="1" maxlength="2" onKeyPress="return isNumberKey(event)">-

<input type="text" name="txtMM" id="datumMM" size="1" maxlength="2" onKeyPress="return isNumberKey(event)">-

<input type="text" name="txtJJJJ" id="datumJJJJ" size="2" maxlength="4" onKeyPress="return isNumberKey(event)">

<input type="text" name="opleverdatum" id="opleverdatum" value="" />

~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around
__________________
~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around
  #2 (permalink)  
Old December 20th, 2006, 10:49 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

First are you using asp or asp.net (looking at your code I would say you are using classic asp) and second are you looking for a server side solution or a javascript solution?

-------------------------
I will only tell you how to do it, not do it for you.††
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
  #3 (permalink)  
Old December 20th, 2006, 11:22 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dparsons
 First are you using asp or asp.net (looking at your code I would say you are using classic asp) and second are you looking for a server side solution or a javascript solution?

-------------------------
I will only tell you how to do it, not do it for you.††
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
I'm using ASP. I'm working with a database and want also take the hidden field value to the next page. But for now I want a javascript solution.

I have tried this code:
<script>
document.getElementById('opleverdatum').value = document.getElementById('datumDD').value + document.getElementById('datumMM').value + document.getElementById('datumJJJJ').value
</script>

I find this code logical! But I get the next error:

document.getElementById('datumDD') has no properties


~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around
  #4 (permalink)  
Old December 20th, 2006, 12:01 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have got the following code and it does work ^_^
Is there something to do better?

<script>
function passValue(){
document.getElementById('opleverdatum').value = document.getElementById('datumDD').value + '-' + document.getElementById('datumMM').value + '-' + document.getElementById('datumJJJJ').value
}
</script>
<form name="form">
<input type="text" value="" name="txtDD" id="datumDD" size="1" maxlength="2" onchange="passValue()" onKeyPress="return isNumberKey(event)">-
<input type="text" value="" name="txtMM" id="datumMM" size="1" maxlength="2" onchange="passValue()" onKeyPress="return isNumberKey(event)">-
<input type="text" value="" name="txtJJJJ" id="datumJJJJ" size="2" maxlength="4" onchange="passValue()" onKeyPress="return isNumberKey(event)">

<br /><input type="text" name="opleverdatum" id="opleverdatum" value="" />
<input type="button" value="klik" />
</form>

~~~~~~~~~~~~~~~~~~~~~~
What goes around comes around
  #5 (permalink)  
Old December 21st, 2006, 03:13 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well

If you just need to concat and add the date to a final textbox, then its fine with respect to javascript.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 


Thread Tools
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
Pass hidden value from one domain to another relaytest49 Classic ASP Professional 6 October 31st, 2006 12:29 PM
Hidden field ashoka_klt ASP.NET 1.0 and 1.1 Basics 1 September 6th, 2006 08:12 AM
pass hidden values X-Ken VS.NET 2002/2003 2 September 8th, 2004 08:38 AM
Pass select values to hidden text field? abq23 Javascript How-To 2 July 20th, 2004 10:47 PM
Validating a hidden field mkerchenski ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 12:20 PM



All times are GMT -4. The time now is 05:12 PM.


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