View Full Version : Radio butons . . . maybe?
goosealaska
01-08-2009, 10:40 AM
I am having parents sign up students for classes on my website and want them to select the # of students to sign up and have that selection expand the form to fit their needs. Can't I script a radio button to do this? For example if they select the two students radio button, two sign up boxes appear--four students radio button, four boxes appear. Or have I lost my marbles?
pdeline
01-08-2009, 10:53 AM
You can do this. You will need to have the maximum number of sign up boxes on the form with a hidden style. When the user selects a radio button, use javascript to show the right number of boxes.
An alternative might be to re-present the form the selected number of times. The form can initially display the radio buttons and a single sign up box. When it is submitted, redisplay it again as many times as necessary.
goosealaska
01-09-2009, 12:04 AM
Great! How? . . . let's just pretend I'm not much on HTML let alone Java. Can I do it? Could I find the script somewhere?
pghcollectibles
01-09-2009, 06:24 AM
lets say you dont know much about javascript (java is a totally different language) w3schools (http://www.w3schools.com) and many other places have good tutorials. this is the one for javascript (http://www.w3schools.com/js/default.asp). after you read through it to get your self familiar with some things, you will find javascript HTML DOM examples (http://www.w3schools.com/js/js_examples_3.asp). there are similar functions (not exactly) but once you are familiar with the DOM (http://www.w3schools.com/htmldom/default.asp) it will be easier to think of how it all works together.
we can help too, but there's this saying about giving away some food or teaching you how to fish thing that comes to mind here. ;)
why dont you post the code you have, here. or a link to the page. dont forget your users will have to have javascript enabled on their browser for your scripts to work right with that method. you can also get around this by using php and multiple forms. this is the second method pdeline was refering to.
css (http://www.w3schools.com/css/default.asp) is something that can be used with or w/o javascript to enable the viewing or non-viewing of elements as well by using style display with none, block, inline or whatever you are trying to do. here (http://www.w3schools.com/css/pr_class_display.asp) is a link on that. (its not found in the standard css tutorial i had to search for it)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.