...

View Full Version : readonly menu list...



homerUK
07-02-2004, 03:03 PM
Hey,

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;
readOnlyAlert();
}


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?

Spudhead
07-02-2004, 04:26 PM
onFocus=this.blur()

?

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?

homerUK
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?

homerUK
07-02-2004, 04:51 PM
onFocus=this.blur()

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

glenngv
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.

javascript:document.forms[0].theSelect.onfocus=null;void(0);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum