I'm rewriting a portion of the PM module. One change is to add a MEMBERS drop down list to the existing CONTACTS list on the "Write a new message" page.
The existing PM module uses form_ functions from common.inc for everything but the drop down lists, and I'm wondering if the working code I wrote for a MEMBERS list can be translated into a form_select function.
Here's the working code, with the XXonChangeXX XXed-out to get through the "suspicious code" filter on the Drupal forum:
$form .= '<select id="edit-quick" name="quick2" XXonChangeXX="document.getElementById(\'edit-recipient\').value=quick2.value"><option value="" selected="selected">--'.t("Members").'--</option>';
$result = db_query("SELECT name AS name from users ORDER BY name", $user->uid);
while ($name = db_fetch_object($result))
{
$name = check_plain($name->name);
$form .= "<option value='$name'>$name</option>";
}
$form .= '</select>';
Here's the function from common.inc:
function form_select($title, $name, $value, $options, $description = NULL, $extra = 0, $multiple = FALSE, $required = FALSE)
I think I can figure out most of the parameters, but I don't understand how to fill the list from $result, or how to do the OnChange code.
If my modifications are of value, I'd be glad to contribute this to the project. Suggestions appreciated.