JS Dynamic Form Elements + Posting to ASP
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: JS Dynamic Form Elements + Posting to ASP

  1. #1
    Join Date
    Nov 2006
    Posts
    357

    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!

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    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)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Nov 2006
    Posts
    357

    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...

  4. #4
    Join Date
    Jan 2009
    Location
    Cochin, India
    Posts
    40

    Smile 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.
    Quote Originally Posted by Grofit View Post
    Hey,

    Would need to do it in Javascript unfortunatly

    Guess ASP doesnt do this sort of stuff...
    Jay
    Support Resort
    http://www.supportresort.com
    Bringing offshore expertise to the world

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center