-
February 23rd, 2009, 11:07 AM
#1
JS Dynamic Form Elements + Posting to ASP
Hello again,
As i come from a PHP background and am doing some ASP work i was wondering how ASP handles dynamic form elements and posting.
Are you able to add dynamic elements to a form via JS and then get ASP to extract that data when its posted to the server? In PHP this stuff is a bit of a pain but allows for some easy to use forms for users, but in ASP it seems a bit stricter when it comes to client side things, unless ASP has visibility of things it just seems to ignore them.
Just to give an example of what i mean:
Imagine having a form with a combo box with numbers from 1-10. When selected X new controls need to appear beneath the combo box for the user to fill in without being submitted to the server. Once filled in and the form is submitted ASP would be able to access the data from each of the dynamically created controls.
In PHP the above wasnt nice, but was easy enough to implement as you could just check for the existance of form elements if you knew they would have a given prefix or similar, then get the data out, but with ASP im not sure how you could go about doing something similar... any help / advice would be great!
-
February 24th, 2009, 12:59 AM
#2
Re: JS Dynamic Form Elements + Posting to ASP
I've seen some articles about using WPF to create dynamic forms.
Just like having a blank web page, then getting a new tab (dynamically)
-
February 24th, 2009, 04:23 AM
#3
Re: JS Dynamic Form Elements + Posting to ASP
Hey,
Would need to do it in Javascript unfortunatly
Guess ASP doesnt do this sort of stuff...
-
February 25th, 2009, 01:24 AM
#4
Re: JS Dynamic Form Elements + Posting to ASP
I agree. You will have to create it using document.createElement() in javascript and add it to the form. Only thing I would like to add to this is if you want to find the post back value of the dynamically created element then you will have to use the Request.Form collection. That is, say you dynamically create a text box and give it a name of 'mytxt' and also an id of 'mytxt' using javascript and added it to the form. Once you post back you will have to use request.form("mytxt") to get at the value typed in the dynamically created text box. Just some additional information if you need it.
Warm Regards.
Originally Posted by Grofit
Hey,
Would need to do it in Javascript unfortunatly
Guess ASP doesnt do this sort of stuff...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|