Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need value from function in textbox

Status
Not open for further replies.

priyankadeven

Programmer
Nov 19, 2002
6
0
0
US
How do I get a value in a textbox after clicking a submit button that calls function that returns that value...?

Shld I say onSubmit=return validate() ie. call function

or Shld I say onChange=return validate() of textbox?
 
the onSubmit event is trigered from the <form> tag. that is the only tag that is is valid for. The onChange event can be used wth most (I think all) form objects.

read up on the uses here


to pass a parameter like the value entered in the textbox you state within the () of the event what to pass to the function. then recieve it again within the () of the function
eg:
<input type=&quot;text&quot; onBlur=&quot;callSomething(this.value)&quot;>
this.value is the same as saying
document.formname.textname.value
then recieve it as a varaible
function callSomething(str)
str = the value passed from the textbox
this defined from devguru.com

The keyword this is used to refer to the current object. In a method, it usually refers to the calling object. In the following example the code first creates a function DescribeAge that takes as its parameter an object, and returns one of two text values depending on the value of that same object's Year property. Then another object called Car is created whose third property Description is the value returned by the DescribeAge function. The keyword this is used as the parameter of the DescribeAge function to refer to whichever object is calling it, as seen in the final bit of code which creates a specific instance of the Car object whose Description property will now contain the string &quot;Old-fashioned&quot;:


____________________________________________________
[sub]The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924[/sub]
onpnt2.gif
 
Thanks so much..

I have a method which takes the value from testbox1 and changes it to what I want.. Now I want to put that value in the other textbox.. How can I put this value in the other textbox?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top