Entry
HOW CAN I GET VALUE OF DYNAMICALLY CREATED TEXTBOX THROUGH JAVASCRIPT ON BUTTON CLICK IN SERVER SIDE
Apr 9th, 2008 20:34
ha mo, Dave Clark, Ranjani Rajagopalan,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ranjani,
Your question is confusing.
1. There is no such thing as a server-side button click.
2. Even the value of a dynamically-created text box will be sent to
the server side when the form is submitted -- provided the text box
has a valid name attribute and the text box is not disabled.
3. Thus, any client-side click of a submit button (or JavaScript
invocation of the submit() method) will be sufficient to send the
value of the dynamically-created text box to the server side.
Now, if what you're really asking is how to get the value of a
dynamically-create text box via JavaScript code, then the following
demonstrates how you can loop through the form's elements collection
and find the desired text box:
var ele = document.forms['formName'].elements;
var x, len = ele.length;
for (x=0; x<len; ++x)
{
if (ele[x].type == 'text')
{
// is this the one you're looking for?
}
}
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.healthinhealth.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com