Rottingham Posted February 6, 2008 Share Posted February 6, 2008 Hello all, I have a list of people in a select box that is for adding family members to a family in my application. The code determines if the persons last name matches the last name of the family they are being added to. If so, it makes the <option selected>. This works fine, and the line is selected, however, it does not force the select list to make that option visible. I.e. If its the 50th person in the list, you still have to scroll down to see it. This is frustrating and so far I haven't found a good way to change it. Does anyone have an idea? I've tried using a javascript code to set the .selectedIndex and that didn't seem to do it. Here is the code for making it selected: / Conveniently select this item if the last name matched the name of the head if(!strcmp($child_last,$head->get_field("Last"))) $child_options .= "<option value=\"$child_id\" selected>$child_last, $child_first</option>\n"; else $child_options .= "<option value=\"$child_id\">$child_last, $child_first</option>\n"; Quote Link to comment https://forums.phpfreaks.com/topic/89775-forcing-a-to-show-the-selectedindex/ Share on other sites More sharing options...
phpQuestioner Posted February 7, 2008 Share Posted February 7, 2008 Are you wanting the select menu to remember what option was previously selected? Quote Link to comment https://forums.phpfreaks.com/topic/89775-forcing-a-to-show-the-selectedindex/#findComment-460338 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.