944,181 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 17650
  • ASP RSS
Jul 17th, 2006
0

text box value in asp

Expand Post »
hi plz tell me how to increment textbox value by 1 whenever click submit button in asp.Example let say now my text box value is 1.When user click submit the text box value must change to 2 and so on.Plz reply me. thanx in advance
Similar Threads
kdv
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kdv is offline Offline
2 posts
since Jul 2006
Jul 21st, 2006
0

Re: text box value in asp

oops...
Last edited by terrencetaylor7; Jul 21st, 2006 at 1:14 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
terrencetaylor7 is offline Offline
6 posts
since Jul 2006
Jul 21st, 2006
0

Re: text box value in asp

sorry, continued.
ASP Syntax (Toggle Plain Text)
  1. <script language="JavaScript">
  2. function addone(){
  3. textbox1.value=eval(textbox1.value + 1)
  4. form1.submit()
  5. }</script>
[html]
<form method="post" action="somepage.asp" onSubmit="addone()"><input type="text" name="textbox1"><input type="submit" value="submit"></form>[/html]

Or more like:
ASP Syntax (Toggle Plain Text)
  1. <script language="JavaScript">
  2. function addone(){
  3. textbox1.value=eval(textbox1.value + 1)
  4. }</script>
[html]
<input type="text" name="textbox1"><input type="Button" value="submit" onClick="addone()"></form>[/html]
Reputation Points: 10
Solved Threads: 0
Newbie Poster
terrencetaylor7 is offline Offline
6 posts
since Jul 2006
Jul 21st, 2006
0

Re: text box value in asp

Quote originally posted by terrencetaylor7 ...
sorry, continued.
ASP Syntax (Toggle Plain Text)
  1. <script language="JavaScript">
  2. function addone(){
  3. textbox1.value=eval(textbox1.value + 1)
  4. form1.submit()
  5. }</script>
[html]
<form method="post" action="somepage.asp" onSubmit="addone()"><input type="text" name="textbox1"><input type="submit" value="submit"></form>[/html]

Or more like:
ASP Syntax (Toggle Plain Text)
  1. <script language="JavaScript">
  2. function addone(){
  3. textbox1.value=eval(textbox1.value + 1)
  4. }</script>
[html]
<input type="text" name="textbox1"><input type="Button" value="submit" onClick="addone()"></form>[/html]
Hi thanx for ur response.Its really helpful.But now I,m facing another problem.Im having one combobox.Once user choose item in combobox, the selected item must be display in textbox with an autonumber.For example:
If combobox value is A.textbox value must be A1.Once user submit,and user choose another item in combobox the item (let say B) textbox must display B2.hope u understand my question.Thanx in advance.Plz post me as soon as possible.Because I need to finish tis function as earlier as possible.
kdv
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kdv is offline Offline
2 posts
since Jul 2006
Jul 22nd, 2006
0

Re: text box value in asp

I think this will do it. Tell me what you think...
[html]
<html><head>
<script language="JavaScript">
function addone(){
form1.counter1.value=eval(form1.counter1.value) + 1
form1.submit()
}</script>
</head><body>
<%
countsofar = CInt(Request("counter1"))
ddselected = CStr(Request("dropdown1"))
textbox1now = ddselected & countsofar
%>
<form method="post" action="test.asp" name="form1">
<select name="dropdown1">
<option value="a" <%if ddselected="a" then response.write("selected") end if%>>a</option>
<option value="b" <%if ddselected="b" then response.write("selected") end if%>>b</option>
<option value="c" <%if ddselected="c" then response.write("selected") end if%>>c</option>
</select>
<input type="text" name="textbox1" value="<%=textbox1now%>">
<input type="hidden" name="counter1" value="<%=countsofar%>">
<input type="button" value="submit" onClick="addone()">
</form>
</body></html>
[/html]
Last edited by terrencetaylor7; Jul 22nd, 2006 at 9:41 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
terrencetaylor7 is offline Offline
6 posts
since Jul 2006
Jul 26th, 2006
0

Re: text box value in asp

[quote=kdv]hi plz tell me how to increment textbox value by 1 whenever click submit button in asp.Example let say now my text box value is 1.When user click submit the text box value must change to 2 and so on.Plz reply me. thanx in advance[/quote


iam sending the coding copy pste in ur applcation

function ChkZero(x) { if(x == "") return 0; else return x; }
function calc(el1,el2,el3,el4) { var a = ChkZero(eval("document.frmansadd."+el1).value); var b = ChkZero(eval("document.frmansadd."+el2).value); var c = ChkZero(eval("document.frmansadd."+el3).value); d = parseInt(a)+parseInt(b)+parseInt(c) eval("document.frmansadd."+el4).value=d; }
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bala_friendd is offline Offline
1 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Searching keywords inside webpages
Next Thread in ASP Forum Timeline: Tree View





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC