View Full Version : readonly menu list...

07-02-2004, 03:03 PM

I know that I can use HTML to "disable" a drop down list - but I dont want to use this method... I need to set some javascript which will not allow the user to select the drop down.... basically disabling it, but still having it there.

I've tried:

function readonlyDrop(ctrl)
this.selectedIndex = 0;

and on the drop down

<select onclick="readonlyDrop(this)">

I've tried <select readonly> but select's dont seem to support this...

any ideas how I can do it?

07-02-2004, 04:26 PM


Otherwise, I'd look again at exactly what you're trying to achieve. Will re-presenting the data, say in a <ul>, do the same thing? Do you really need it in a select box?

07-02-2004, 04:36 PM
the disabled or not select menu is based on the users access rights.

the page can be read/write where the user can update values - and read only where they can see elements but not update them. This is what I want to acheive with the select box.

I might have to just disable it.... but the other text input fields are readonly and stay the same colour... I wonder if I can disable it but apply a style to make it not greyed out?

07-02-2004, 04:51 PM

that has actually done the trick!! :D :thumbsup:

07-05-2004, 07:07 AM
You should still double-check the access rights in the server-side as anyone can bypass it by typing this in the address bar.