Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - Using Radio And Text Input For The Same Form Element | New poll | | |
Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Elric Octoballoon Since: 11-18-05 From: Melniboné Last post: 6698 days Last view: 6330 days |
| ||
Yeah, the title may be a little confusing, since I'm not exactly sure how to sum it up...
Anyway, what I want to do is have a for with a set of choices. You pick your choice by radio button, but I want the last choice to allow you to enter custom data into a text-type input ( input type=text not < ).
My problem is this: I can make it save the data from one OR the other, but not both. For example, if I have this: Thing A Thing B Custom: (code: < )
I can make it so that anything entered in Custom is saved, but then if Thing A or Thing B is selected, it ignores it, and just saves whatever was last in Custom. Or, I can make it so that it saves the data from Thing A or Thing B, but if Custom is selected, it ignores it, and just saves the data from whichever Thing (A or B) was chosen last. How do I make it so that it saves the data from whatever one is chosen? |
|||
neotransotaku Sledge Brother Liberated from school...until MLK day Since: 11-17-05 From: In Hearst Field Annex... Last post: 6303 days Last view: 6300 days |
| ||
Could you try to use javas |
|||
Elric Octoballoon Since: 11-18-05 From: Melniboné Last post: 6698 days Last view: 6330 days |
| ||
1) It's for my board, so probably not...
2) I don't know JS... |
|||
Cellar Dweller + Red Koopa Since: 11-18-05 From: Arkansas Last post: 6310 days Last view: 6301 days |
| ||
It's simple. Give the text and radio inputs seperate names, and have your PHP(or whatever) script check to see if the custom radio button is selected. If it is, save the value in the text field, else save the value in the radio field.
For example, if the radio field is named test_radio and the text field is named test_text you can have
if ($test_radio == "C") { in your PHP code or, more compactly, $test = ($test_radio == "C")?$test_text:$test_radio; . |
Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - Using Radio And Text Input For The Same Form Element | | |