Re: scroll down list -visible, but not possible to choose

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 31 Aug 2011, robert@xxxxxxxxxx wrote:

I have the below function with array for satus of issues where I need to have 'Resolved/Closed' visible but not available for choice
This as closing is a separate function to ensure correct resolution code is selected

Already tried removing 'Resolved', and got everything working only to notice when testing that when viewing issues the Resolved
ones showed up as 'Support Working' even though closed in the system

There are two possible points of failure here, your code and browser behaviour. Whenever I'm faced with this sort of problem, I look at the source code in my browser to see the HTML my code generates. Then I can determine if my code is outputting what I'd intended. If it is, then my code is right but the implementation is wrong, as the correct HTML produces the incorrect result.

If you'd done this, you'd have seen what the problem is. The problem is that, having taken away "Resolved" as a possible option, all items marked "Resolved" are unable to be listed as selected. Consequently no items are selected and the browser defaults to the first item in the list which is "Support Working".

I've never had to do this, but http://www.w3schools.com/TAGS/tag_option.asp says you can use the "disabled" attribute to disable an option. So your resulting HTML could look like this:

<option value="Resolved" disabled>Resolved</option>

or

<option value="Resolved" disabled selected>Resolved</option>

as appropriate. A simple if statement could be used to set the "disabled" attribute for the "Resolved" selection only.

IMHO this is vastly preferable to any trickery you may use with javascript to prevent the user from selecting Resolved.

I've never struck a select field like this and am now interested in coding one up just to see how it works in practice.

HTH,
Geoff.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux