Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Display value in textbox from button click
Old 05-04-2007, 05:21 PM Display value in textbox from button click
Experienced Talker

Posts: 35
Name: remya
Trades: 0
i'm able to display the corresponding dates in two textbox while clicking the buttons "Last 1 Month" and "Last 3 Month".
and while pressing the Submit button the dates displayed in the textbox should be display in that textbox itself.
if we changed the date after the display in that textbox , then the new dates should be displayed while pressing the submit button.
this is the code i tried to get the value displayed i the textbox and display it while we press submit button.
<html>
<head>
<script language="VBScript">
sub onemonth()
form1.datefrom.value = dateadd("m",-1,date())
form1.dateto.value = date()
end sub
sub threemonth()
form1.datefrom.value = dateadd("m",-3,date())
form1.dateto.value = date()
end sub
sub viewrecord()
form1.datefrom.value = strdatefrom
form1.dateto.value = sttrdateto
end sub
</script>
</head>
<body>
<form name="form1" method="post">
<BR>
<input type="button" value="Last 1 Month" name="buttonname" onclick="onemonth"/>
<input type="button" value="Last 3 Month" name="buttonname" onclick="threemonth"/>
<input id="datefrom" type="text" name="datefrom" size="20"/>
<input id="dateto" type="text" name="dateto" size="20"/>
<input name="b2" type="button" VALUE="Submit" onclick="viewrecord()"/>
<% Dim strdatefrom, strdateto
strdatefrom = trim(Request.form("datefrom"))
strdateto = trim(Request.form("dateto")) %>

</form>
</body>
</html>
but its not taking the values Request.form("datefrom").
and if we use button, it will display the dates in textbox. but if we use submit it will show the date a glance and make the textbox blank. we wont be able to see the date if we give submit.
and we post will be done by submit button, and if we give button, it wont post the value.
if you have any idea what wrong in my code just help me.
how can i make this display the content in the textbox to the same textbox after clicking a button or submit button.
thanks in advance
remya1000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-04-2007, 06:35 PM Re: Display value in textbox from button click
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
because you are mixing up client side script and server side script

you dim & assign the variables server side BUT they cannot be passed to the code in the <script> block with the code you have.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-07-2007, 10:14 AM Re: Display value in textbox from button click
Experienced Talker

Posts: 35
Name: remya
Trades: 0
then how can i pass the value and display it again in that textbox.
i'm new to ASP. so if you have any idea, please help me and give some idea's.
thanks in advance
remya1000 is offline
Reply With Quote
View Public Profile
 
Old 05-07-2007, 09:07 PM Re: Display value in textbox from button click
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Do it without using asp. It's all javascript for what you need.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Display value in textbox from button click
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15587 seconds with 12 queries