This is a migrated thread and some comments may be shown as answers.

Get value of textbox placed in FormView

3 Answers 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 12 May 2008, 01:53 PM
Hi,

I am trying to implement add/remove items into Combobox functionality using a client-side API same as sample provided in /ComboBox/Examples/Programming/AddRemoveDisableItemsClientSide.
But my controls are placed in a FormView and it seems that I have problem to get value of a textbox within javascript function. The line from sample:

function

AddNewItem(){

...


var
intextput = document.getElementById("TextBox1").value;

...

}


is not working. How can I get value of a textbox placed in a FormView control using javascript?

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 13 May 2008, 12:03 PM
Hello Sergey,

I suggest that you obtain the textbox's value using this code:

var intextput = document.getElementById("FormView1_TextBox1").value; 

where FormView1 is the ID of the formview and TextBox1 is the ID of the textbox.

I hope this helps.

All the best,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Vijayakumar
Top achievements
Rank 1
answered on 11 Apr 2019, 04:57 PM
Yes it works! for me
0
Himanshu
Top achievements
Rank 1
answered on 05 May 2019, 03:12 PM
if you want to get the value of a textbox you can get it by js code
first search the element by "getElementById" and to receive value of variable ".value"

so final code will become

var myNewVar = document.getElementById("FormView_TextBox").value; 

value of textbox will be saved in myNewVar

Thanks
Tags
General Discussions
Asked by
Sergey
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Vijayakumar
Top achievements
Rank 1
Himanshu
Top achievements
Rank 1
Share this question
or