Jump to content

add a new text box to a form


damiancds
 Share

Recommended Posts

I'm working on a form, and I'd like for people to add things in steps, where some people might only have three items to add, and some may have five and so on (either way a difference). I'd like a button that adds a text box dynamically without reloading the page so people can keep adding a new item. But, the main thing is I don't want to do it with JavaScript, because it wouldn't work for the people who have it turned off, and then the whole form would be pointless.I've toyed with the idea of having them hidden but then there's always the problem of someone reaching the limit of the boxes I've put in. I'd like to know if this is possible either with plain HTML, or something like PHP, basically where the form will work regardless of the users settings.thanks,

Link to comment
Share on other sites

Well, you can always have JavaScript for the people with it enabled and then fallback to refreshing the page every time if they don't - HTML is not dynamic and PHP only operates on the server. How would you display the hidden textareas without using JavaScript anyway?

Link to comment
Share on other sites

I actually thought that you could hide/ unhide without javascript.I guess i'll try the with javascript and without + reload, and see how i like it.Otherwise, I might just do a text area and figure something out with that.thanks,

Link to comment
Share on other sites

I actually thought that you could hide/ unhide without javascript.
You can. Just not dynamically. :)
I guess i'll try the with javascript and without + reload, and see how i like it.
I think that's pretty much your only option.
Link to comment
Share on other sites

The normal thing is to START with all items visible. On pageload, use JavaScript to hide them. If JavaScript is on, the page will look as you want, and you can use javascript to toggle their display property as suggested above. If javascript is disabled, the user will have access to everything. The only difference is the experience won't be as pretty. Tough.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...