Jump to content

How to hide 'radio' button


imimin

Recommended Posts

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.