Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
User | Post |
Cellar Dweller + Posts: 6/138 |
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; . |
Elric Posts: 77/164 |
1) It's for my board, so probably not...
2) I don't know JS... |
neotransotaku Posts: 101/1860 |
Could you try to use javascript form processing before you submit your form to wherever your form is going to go? This way, you can set a specific variable that will take data from one of those three? |
Elric Posts: 75/164 |
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? |