Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2006, 10:24 AM
Authorized User
 
Join Date: Dec 2006
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
 
Old December 20th, 2006, 10:49 AM
Wrox Author
 
Join Date: Oct 2005
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
 
Old December 20th, 2006, 11:22 AM
Authorized User
 
Join Date: Dec 2006
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
 
Old December 20th, 2006, 12:01 PM
Authorized User
 
Join Date: Dec 2006
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
 
Old December 21st, 2006, 03:13 AM
Friend of Wrox
 
Join Date: Aug 2004
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.





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 07:12 AM
pass hidden values X-Ken VS.NET 2002/2003 2 September 8th, 2004 07:38 AM
Pass select values to hidden text field? abq23 Javascript How-To 2 July 20th, 2004 09:47 PM
Validating a hidden field mkerchenski ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 11:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.