imimin Posted May 14, 2009 Share Posted May 14, 2009 This a HTML coding question (I hope you don't mind)? Does someone(s) know how to make a 'radio' button invisible? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/ Share on other sites More sharing options...
Brian W Posted May 14, 2009 Share Posted May 14, 2009 why do you need it be invisible? <input type="radio" name="Radio" value="1" id="Radio1" style="display:none;"> to undo the hide: <a href="javascript:void();" onClick="document.getElementById('Radio1').style.display='';">Show</a> Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-834216 Share on other sites More sharing options...
gaza165 Posted May 14, 2009 Share Posted May 14, 2009 http://www.hiteshagrawal.com/javascript/showhide-html-elements-using-javascript Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-834220 Share on other sites More sharing options...
imimin Posted May 14, 2009 Author Share Posted May 14, 2009 Thanks! I have a single item I need to display that needs to be passed to a shopping cart. I don't want the radio button to be displayed in someones face with no other option. Thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-834222 Share on other sites More sharing options...
Brian W Posted May 14, 2009 Share Posted May 14, 2009 well, as long as what we gave you helped... I guess it works. But if your outputting the selection with php, wouldn't it be easier/more logical to simply not output the other radio boxes if they don't have options? If you want to present to the user that there is sometimes options, but not in this case, you can disable the options. One:<input type="radio" name="Radio" value="1" id="Radio1"><br> Two:<input type="radio" name="Radio" value="2" id="Radio1" disabled><br> Three:<input type="radio" name="Radio" value="3" id="Radio1" disabled> Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-834225 Share on other sites More sharing options...
TheFilmGod Posted May 14, 2009 Share Posted May 14, 2009 Or you can simply do "style="display: none;" within the tag like so: <input type="radio" style="display: none;" /> And it's invisible. Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-834422 Share on other sites More sharing options...
AmandaF Posted May 15, 2009 Share Posted May 15, 2009 You don't want it displayed for usability/aesthetic reasons, right? The CSS and JS solutions given are fine if that's all it is, but if there's a security issue involved keep in mind that the user can always get around the css and js by disabling them in their browser. Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-834916 Share on other sites More sharing options...
Ken2k7 Posted May 16, 2009 Share Posted May 16, 2009 JavaScript solutions to this is a bad idea. CSS is good. Who would disable CSS just for that? I mean they would literally be looking at black text with white background. Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-835084 Share on other sites More sharing options...
TheFilmGod Posted May 16, 2009 Share Posted May 16, 2009 A correctly programmed script will not be vulnerable. Remember - if the checkbox is disabled/invisible, that means the user can't change/shouldn't change the data. You could easily store that information as a session, and just let it pass from the first page to the third page without a problem. Do not allow the php script to "redetermine" the checkbox value. This is a possible security risk. If you're using js or css, make sure you have: disabled="disabled" within the input tag. A user can't disable html or change the syntax. Quote Link to comment https://forums.phpfreaks.com/topic/158148-how-to-hide-radio-button/#findComment-835112 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.