Dynamic form - text boxes for address

  MS35 19:42 24 Nov 2007
Locked

Can someone help point me in the right direction for some example code for dynamic forms.

I'm designing in .php and have web pages referencing a mySQL database which are working fine.

On a specific page i've got a checkbox in a form and would like to link this dynamically to create a series of fields (address1, address2 etc) that would appear when the checkbox is selected and remove them if it's later unchecked. (default unchecked)

Is this possible ? I think it's javascript i'm after?

Thanks

  Kemistri 19:53 24 Nov 2007

Yeah, that's JS. A quick web search will reveal a plethora of resources that will tell you how to do it.

  MS35 20:09 24 Nov 2007

I've been Googling away for a couple of hours and must be searching on the wrong things 'cos I'm not coming up with much close - hence the request to be "pointed in the right direction"

  CodeMeister 21:47 24 Nov 2007

I'm guessing that you're looking for something like this click here

Do bare in mind though that a significant number of web users have JavaScript turned off and they won't be able to use a page employing this technique.

  MS35 21:57 24 Nov 2007

I wasn't aware that users can turn Javascript off, but presumably it runs client side so there is that option. (do many general users/browsers do this?)

One other thought would be to use a click here button rather than a checkbox and take the user to a separate input page and then carry the information forward as a session variable. Are there any other options I should be looking at that would deliver the same result without restricting users?

Cheers

  Kemistri 22:11 24 Nov 2007

You first have to hide the form section using JS so that it will appear for script-blocking browsers and screen readers. If you have not already got either of these books click here or click here, you should get one.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Alienware 17 R4 2017 review

These brilliant Lego posters show just what children's imaginations are capable of

Mac power user tips and hidden tricks

Comment réinitialiser votre PC, ordinateur portable ou tablette Windows ?