Click to See Complete Forum and Search --> : dynamically adding controls


kydo76
05-24-2003, 05:12 AM
i wanted to have a page that contains an input box and 2 buttons (Add and Remove).

When you click on the Add button, it will add another input box right below the one previously there (however, through the use of a break tag or a table or anything else you can think of)

when you click on the Remove button, it will remove the last input box that was added

also, if it's done by refreshing the page somehow, with the added control created with the refresh, how can i keep any information that was previously typed before the page was refreshed

thanx.. : )

Charles
05-24-2003, 05:58 AM
It could be easily done using JavaScript and the W3C Document Object Model (DOM), but I cannot see how you would keep your page working for the one in ten users who do not use JavaScript and the one percent or so that use JavaScript but not browsers that understand the DOM. And the way you would impliment this would have to be tailored around how your page will 'fail safe' for those good people. If you could tell us that then we could help you.

kydo76
05-24-2003, 03:45 PM
so you're trying to imply that i do this with one of the server-side scripting languages?

Charles
05-25-2003, 04:22 AM
Originally posted by kydo76
so you're trying to imply that i do this with one of the server-side scripting languages? I'm implying nothing. I don't have the big picture of you project, so I don't know if there's a client side way to make things work. And if you do have to resort to a server side method, you should have a redundant client side script thing going on. That way the page will always work but the folks with JavaScript will not have to wait for another HTTP response.

Do whatever it takes to get your page working well enough without JavaScript and then give us a look at it and we can help you add the bells and whistles.