473,655 Members | 3,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unable to access the values of input elements created using javascript

I have added some input elements on a page using
javascript at client side.
when i submit the page, i am unable to access the values
of input elements created using request.form.
Are elements created using javascript are available at the
server?
if not how can i do the above thing so that there values
can be accessed.
I dont want to postback page everytime i need to create a
new element.

Nov 19 '05 #1
6 2158
Vikram,

When you create your input elements are you adding the runat="server"
attribute? That should make the control available on the server (I
think). Of course you will have to cast it to the proper type.

Let me know how you make out.

Nov 19 '05 #2
No basically after a page is displyed at client, user can
click a '+" button which will create text box without
posting back to server i.e. using javascript.
After that user will submit the page.....
-----Original Message-----
Vikram,

When you create your input elements are you adding the runat="server"attribute? That should make the control available on the server (Ithink). Of course you will have to cast it to the proper type.
Let me know how you make out.

.

Nov 19 '05 #3
Are you adding the name property of the control? Without the name property
I do believe the element is not considered postable.

<input type="text" name="txtDynami c" />

Request.Forms["txtDynamic "];

bill

"Vikram" <an*******@disc ussions.microso ft.com> wrote in message
news:0f******** *************** *****@phx.gbl.. .
I have added some input elements on a page using
javascript at client side.
when i submit the page, i am unable to access the values
of input elements created using request.form.
Are elements created using javascript are available at the
server?
if not how can i do the above thing so that there values
can be accessed.
I dont want to postback page everytime i need to create a
new element.

Nov 19 '05 #4
Understood. But when that textbox is created you must specify certain
attributes of the input element Such as the name property (as Bill
pointed out). Then if you want to access these WHEN the postback occurs
you will also have to add the runat=server attribute.

Send a code snippet if you like and we can get it you work for you.

Nov 19 '05 #5
you are probably missing the name attribute. try:

in browser:

<script>
document.write( '<input type="text" name="myText" value="test value">
</script>

on postback:

sting myValue = Request.Form["myText"];

-- bruce (sqlwork.com)
"Vikram" <an*******@disc ussions.microso ft.com> wrote in message
news:0f******** *************** *****@phx.gbl.. .
I have added some input elements on a page using
javascript at client side.
when i submit the page, i am unable to access the values
of input elements created using request.form.
Are elements created using javascript are available at the
server?
if not how can i do the above thing so that there values
can be accessed.
I dont want to postback page everytime i need to create a
new element.

Nov 19 '05 #6
Thanks a lot.
U were right
-----Original Message-----
you are probably missing the name attribute. try:

in browser:

<script>
document.write ('<input type="text" name="myText" value="test value"></script>

on postback:

sting myValue = Request.Form["myText"];

-- bruce (sqlwork.com)
"Vikram" <an*******@disc ussions.microso ft.com> wrote in messagenews:0f******* *************** ******@phx.gbl. ..
I have added some input elements on a page using
javascript at client side.
when i submit the page, i am unable to access the values
of input elements created using request.form.
Are elements created using javascript are available at the server?
if not how can i do the above thing so that there values
can be accessed.
I dont want to postback page everytime i need to create a new element.

.

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4713
by: Roger Godefroy | last post by:
Hi there... I want to read fieldvalues from out of a dynamicaly created table (php). But this has to be done by JavaScript. Every row of the table has a select-box, inputbox and a order-button. So if I press on "order" at row 8, I just want to popup "Product 8 - Price - Quantity" using alert()corresponding to the rowvalues from where the button was pressed. Any help appreciated.
1
6010
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that required fields in a form have values. I'm writing the values to the client using document.write only so that I can confirm that the values are there to be played with - this is not the final result so please (unless it's leading to the script failure)...
1
3185
by: Will | last post by:
Hi, I have a problem trying to validate dynamically created html form elements using javascript. I have dynamically created a check box using ASP for each record in a recordset and have given each a unique ID using the primary key from a db table. e.g "chk" + "1" for record 1 and "chk" + "2" for record 2 etc. This means each box is called chk1 and chk2 respectively. This works fine and changes dependant on the recordset used and allows me...
15
12362
by: crjunk | last post by:
I have 4 TextBoxes on my form that I'm trying to add together to get a grand total. Here is the code I'm using: <SCRIPT LANGUAGE="JavaScript"> <!-- Beginning of JavaScript - function calcTotalPub() { var tempFed = +document.Form1.value; var tempState = +document.Form1.value;
7
7930
by: Utter Newbie | last post by:
Just wondeing if there is a way to keep from having a certain parameter sent when posting a form to another page (method=get)... So as an example a page will post something like this from a form using "get": http://mypage?firstElement=1&secondElement=2 How can you completely remove "secondElement=2" from the querystring... Before moving on to the posted page?
10
3070
by: soup_or_power | last post by:
The pop up window has several checkboxes. I'm unable to access the checkboxes using the handle from window.open. Any way to do this? var display; function showSugg(but_id, sugg1, sugg2, sugg3, sugg4, sugg5) { display=window.open('','_blank','menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbars=yes,height=150,width=190')
7
6986
by: Lau Lei Cheong | last post by:
Hello, I'm using javascript's insertAdjacentHtml() to insert images to the webform at runtime. This runs fine(image successfully displayed at the browser) but when I tried to access the control's src using FindControl() function in the code-behind, it seems that the control doesn't even exist. I know that I can add controls on the server-side, but then a postback will be needed which is the thing I want to avoid. Does anyone have idea...
2
2533
by: Ed Jay | last post by:
I'm dynamically creating several form input elements: mValue = integer constant; for(var j = 0; j < mValue; j++) { target = "imgCn"+ j; eName = "myFile"; eName = eName+jj; document.getElementById(target).innerHTML = "<input type = 'file' name="+eName+" value=''>text"; }
3
2474
by: nicky77 | last post by:
Hi there, newish to javascript so grateful for any help. I am creating a test generator and have an array of textfields ("answer") created by a simple piece of PHP code. As you can see, I have radio buttons corresponding to each text field, which is a potential answer to a multi choice question. I already have working code which ensures that an answer is selected and not the default option. However, I also want to validate that when an answer...
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.