Personal computing discussed

Moderators: SecretSquirrel, just brew it!

 
Shinare
Gerbil XP
Topic Author
Posts: 414
Joined: Wed Jul 06, 2005 12:48 pm

How to dynamically add controls to a web page?

Wed Apr 20, 2016 1:41 pm

Hi all,
I am a beginning web developer and I was wondering if anyone had any ideas on this. I saw this on a page I frequent at http://poe.trade which is an item trading site for a game I play often. On that page you can search for an item based on the "mod's" it has. The page starts off with a single drop down box and you can start typing in a "mod" and it will autofill from available mods to pick from. Once selected you can add values into other text boxes that go along with that mod that you are searching on.

If you want to add mods to search on you hit the "Add Mod" button and another set of those controls appear which you can continue to fill out. You can add as many mods as you want to narrow down the results. That's almost exactly the type of thing I am wanting to do on my own site. I wont be doing searches, just letting people add as many "items" to a list as they want and fill in associated info for each items, than submit the list in an email.

Can anyone give me a nudge in the right direction as to what I should be searching for out there, or any hints on how this is done? This might (read "probably") be way out of my skill level, but I saw that and thought it was a very slick way of doing that!

Edit: I guess I should mention that my site is on IIS and uses ASPX pages. I know VB and not c# but if I could just be pointed in the right direction it would be helpful. :)
For with what measure you measure it will be measured to you.
Image
 
DancinJack
Grand Gerbil Poohbah
Posts: 3182
Joined: Sat Nov 25, 2006 3:21 pm
Location: Kansas

Re: How to dynamically add controls to a web page?

Wed Apr 20, 2016 1:54 pm

I mean, there are a number of ways to do this. You just need to find the best way for you.

JS, JQuery come to mind. Using style to hide stuff until a checkbox/button is pressed.
i7 6700K - Z170 - 16GiB DDR4 - GTX 1080 - 512GB SSD - 256GB SSD - 500GB SSD - 3TB HDD- 27" IPS G-sync - Win10 Pro x64 - Ubuntu/Mint x64 :: 2015 13" rMBP Sierra :: Canon EOS 80D/Sony RX100
 
Redocbew
Gold subscriber
Graphmaster Gerbil
Posts: 1347
Joined: Sat Mar 15, 2014 11:44 am

Re: How to dynamically add controls to a web page?

Wed Apr 20, 2016 1:59 pm

Yeah, you're going to need some kind of ajax(ish) call in order to make that work, and you'll probably be using a javascript library, like jQuery to do it.

Some quick googling turned up this link, which gives you the basics of using ajax.

http://www.sitepoint.com/use-jquerys-ajax-function/

If the form submit can handle a variable number of fields(and if so, hopefully it's not too variable), or there's some trickery that concatenates all the mods into one string, for example, then you may be able to avoid a call back to the server and just deal with everything inside the browser. It just depends on how the site is built currently.
Do not meddle in the affairs of archers, for they are subtle and you won't hear them coming.
 
Shinare
Gerbil XP
Topic Author
Posts: 414
Joined: Wed Jul 06, 2005 12:48 pm

Re: How to dynamically add controls to a web page?

Wed Apr 20, 2016 2:11 pm

[deleted]
see post below
Last edited by Shinare on Wed Apr 20, 2016 2:26 pm, edited 1 time in total.
For with what measure you measure it will be measured to you.
Image
 
Shinare
Gerbil XP
Topic Author
Posts: 414
Joined: Wed Jul 06, 2005 12:48 pm

Re: How to dynamically add controls to a web page?

Wed Apr 20, 2016 2:25 pm

WOW, thanks for that, doing a search on those terms did in fact get me to exactly what I am wanting!! :)

http://www.asp.net/web-forms/videos/asp ... a-web-page
For with what measure you measure it will be measured to you.
Image

Who is online

Users browsing this forum: No registered users and 2 guests