/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I have two tables data.
After querying it I have two results.
I should insert into one list box where data from table A i should color it in font black and another in red and disable it(from table ? into same list box.

I have to disable only names in list box.

[CODE]
<td align=”left”>
<select name=”cluster”>
<option value=”–” selected>–
<?
$clusters = clusterNames();
foreach($clusters as $c){
echo “<option value=”$c”>$c”;
}
?>

[/CODE]

How can i do it

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@sandy1028authorNov 05.2007 — Tell me how to disable few names in list box......
[CODE]
<select name="user">
<option value="value">1</option>
<option value="value">2</option>
<option value="value">3</option>
<option value="value">4</option>
<option value="value">5</option>
</select>

[/CODE]


How to disable value1 and value2. and all the others enabled
Copy linkTweet thisAlerts:
@NogDogNov 05.2007 — Add the [b]disabled="disabled"[/b] attribute to the [b]<option>[/b] tag.
Copy linkTweet thisAlerts:
@sandy1028authorNov 05.2007 — Add the [b]disabled="disabled"[/b] attribute to the [b]<option>[/b] tag.[/QUOTE]


Please give some example. I am not able to disable it using

<option value=1 disabled>
Copy linkTweet thisAlerts:
@NogDogNov 05.2007 — If outputting XHTML, you must supply a value to the attribute:
<i>
</i>&lt;option value=1 disabled="disabled"&gt;

In any case, it appears IE does not support this (no big surprise, eh?), though it worked fine for me in Firefox (no big surprise again). The only work-around I can see would be an onchange event added to the select item, calling a javascript function to determine if the selected option is supposed to be disabled, and if so then reverting the selection back to the previous value. However, this does not help if the user has JS disabled.

Of course, a much simpler solution would be to just omit any unwanted options completely. ?
×

Success!

Help @sandy1028 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...