Forums
This topic is locked
Radio button with value from text field
Posted 28 Jun 2007 05:17:27
1
has voted
28 Jun 2007 05:17:27 Rhys Parry posted:
Hi. I'm using DWMX to build some ASP pages against an Access 2003db.I have a group of radio buttons that I'm using to capture one of 4 pre-defined values. This much is working very nicely.
What I'd like to do is add a fifth button to the same group but allow the value come from what the user types into a text box. So the question is: how do I combine a text field with a radio button? Or is there another solution?
I've tried quite a few ways to make this work but can't seem to figure it out.
Thanks for the help.
Replies
Replied 29 Jun 2007 10:46:43
29 Jun 2007 10:46:43 alin canbas replied:
this isnt easy but, you should first handle the db data, so get the data from access db and then keep it in a session lets say or in a variable and then get the value from user and combine them, normally adding is easy radiobutton.add(......)
also check here www.findindirectory.com/fallin.aspx?pr=Computers/Programming/Databases/
www.findindirectory.com/fallin.aspx?pr=Computers/Programming/Databases/ADO/
also check here www.findindirectory.com/fallin.aspx?pr=Computers/Programming/Databases/
www.findindirectory.com/fallin.aspx?pr=Computers/Programming/Databases/ADO/
Replied 30 Jun 2007 19:49:13
30 Jun 2007 19:49:13 Alan C replied:
One way to consider -
add the extra button, and the text field, give them appropriate names, then when you receive the values use a bit of php to check the value of the radio group then if it's the appropriate button pick up the value from the text field.
You might be able to do it with javascript too, by checking the radio button and only making the text field available when the right button is used - I don't do a lot of javascript so I can't help with that.
add the extra button, and the text field, give them appropriate names, then when you receive the values use a bit of php to check the value of the radio group then if it's the appropriate button pick up the value from the text field.
You might be able to do it with javascript too, by checking the radio button and only making the text field available when the right button is used - I don't do a lot of javascript so I can't help with that.
Replied 17 Jul 2007 14:45:12
17 Jul 2007 14:45:12 Rhys Parry replied:
Thanks for the replies.
I'm not trying to pull a dynamic value from access. Instead, I'm trying to offer three choices to a user using radio buttons. Options 1 through 4 will have a pre-defined value. Option 5 is meant to allow the user to type in their own answer.
The typical radio button code looks like:
<td><input type="radio" name="Speed" value="130" /> 130</td>
Isn't there a way to simply substitute 'value="130"' with 'value="[some kind of user input]"'?
I tried nesting a text box in here but that doesn't seem to work. I don't know PHP or Java. As a matter of fact, I'm working with ASP/VBScript in the first place just to teach myself some web dev basics.
I'm not trying to pull a dynamic value from access. Instead, I'm trying to offer three choices to a user using radio buttons. Options 1 through 4 will have a pre-defined value. Option 5 is meant to allow the user to type in their own answer.
The typical radio button code looks like:
<td><input type="radio" name="Speed" value="130" /> 130</td>
Isn't there a way to simply substitute 'value="130"' with 'value="[some kind of user input]"'?
I tried nesting a text box in here but that doesn't seem to work. I don't know PHP or Java. As a matter of fact, I'm working with ASP/VBScript in the first place just to teach myself some web dev basics.
Replied 17 Jul 2007 20:21:22
17 Jul 2007 20:21:22 Alan C replied:
Hmmm, this is not an easy thing to do I don't think.
I can only think of two ways, Javascript or server-side processing, but then there are better coders than me out there so one of them might prove me wrong <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Once the page has been served to the client it's going to be static, so that means that if you want to change something like this - that is pick up a user-inserted value, it has got to go back to the server somehow. My preferred way of doing it would be to have option 5 AND the textbox, then when the form data came back to the server I would look it over and test it to decide what to do.
You can't decide what to do until you know whether the client selected that 5th button, and you will not know that until you get the inputs back to the server or use Javascript. I really don't think you can do it any other way.
I realise you can't do that if you don't do php, but I think you will be able to do the same with asp, I can't help with that as I took a policy decision to avoid anything MS where possible (yes this is coming from a pc, but I have just bought another mac and will sonn be back on that)
I can only think of two ways, Javascript or server-side processing, but then there are better coders than me out there so one of them might prove me wrong <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Once the page has been served to the client it's going to be static, so that means that if you want to change something like this - that is pick up a user-inserted value, it has got to go back to the server somehow. My preferred way of doing it would be to have option 5 AND the textbox, then when the form data came back to the server I would look it over and test it to decide what to do.
You can't decide what to do until you know whether the client selected that 5th button, and you will not know that until you get the inputs back to the server or use Javascript. I really don't think you can do it any other way.
I realise you can't do that if you don't do php, but I think you will be able to do the same with asp, I can't help with that as I took a policy decision to avoid anything MS where possible (yes this is coming from a pc, but I have just bought another mac and will sonn be back on that)