Jump to content

How to hide 'radio' button


imimin

Recommended Posts

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>

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.