Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > unable to access the values of input elements created using javascript

Reply
Thread Tools

unable to access the values of input elements created using javascript

 
 
Vikram
Guest
Posts: n/a
 
      04-06-2005
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.

 
Reply With Quote
 
 
 
 
James Steele
Guest
Posts: n/a
 
      04-06-2005
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.

 
Reply With Quote
 
 
 
 
Vikram
Guest
Posts: n/a
 
      04-06-2005
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 (I
>think). Of course you will have to cast it to the proper

type.
>
>Let me know how you make out.
>
>.
>

 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      04-06-2005
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="txtDynamic" />

Request.Forms["txtDynamic"];

bill

"Vikram" <> wrote in message
news:0f9601c53ab3$9d019210$...
> 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.
>



 
Reply With Quote
 
James Steele
Guest
Posts: n/a
 
      04-06-2005
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.

 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      04-06-2005
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" <> wrote in message
news:0f9601c53ab3$9d019210$...
>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.
>



 
Reply With Quote
 
Vikram
Guest
Posts: n/a
 
      04-07-2005
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" <> wrote in

message
>news:0f9601c53ab3$9d019210$...
>>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.
>>

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read input value from dynamic created input controls Melissa ASP .Net 2 12-26-2008 07:48 AM
IE 6/7 javascript class assignment for newly created elements Craig Taylor Javascript 2 01-18-2007 04:44 PM
Javascript-created elements won't trigger in IE joeakabloo@gmailabc.com Javascript 1 04-24-2006 12:53 PM
problem when a map type variable uses an integer created with random() to access its elements jprunier C++ 1 08-31-2004 10:22 AM
Access dynamically created Form elements Will Javascript 1 01-23-2004 12:20 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57