function ApplyToRoles(matching) { re = new RegExp("^" + matching + "_" ) for ( var i=0; i < document.forms.form.elements.length ; i++ ) { if ( document.forms.form.elements[i].name.match( /^role/ ) ) { if ( document.forms.form.elements[i].value == '' ) { if ( document.forms.form.elements[i].id.match( re ) ) { document.forms.form.elements[i].value = document.forms.form.default_role.value; } } } } return true; } </script> SCRIPT; $ef->TempLineFormat('<span class="srchf" style="white-space: nowrap">%s%s</span>'); $btn_clients = $ef->DataEntryLine("", "", "button", "apply_clients", array("value" => "Client", "onclick" => "ApplyToRoles('client');", "title" => "Click to apply the default to unassigned users for this system.", "class" => "fsubmit")); $btn_contractors = $ef->DataEntryLine("", "", "button", "apply_contractors", array("value" => "Contractor", "onclick" => "ApplyToRoles('ext');", "title" => "Click to apply the default to unassigned users for this system.", "class" => "fsubmit")); $btn_internal = $ef->DataEntryLine("", "", "button", "apply_internal", array("value" => "Internal", "onclick" => "ApplyToRoles('int');", "title" => "Click to apply the default to unassigned users for this system.", "class" => "fsubmit")); $ef->RevertLineFormat(); $html .= "Choose a default and apply to unassigned {$btn_clients} / {$btn_contractors} / {$btn_internal} users</th>"; $html .= '<td class="entry" align="center">'; $options = array_merge($roles, array("title" => "Select the default role people have in relation to this system")); $html .= $ef->DataEntryField("", "select", "default_role", $options); $html .= "</td></tr>"; echo $html; } $options = array_merge($roles, array("title" => "Select the role this person has in relation to this system")); $fld_format = '<span style="background-color: %s;"> %s </span>'; $i = 0; while ($row = $q->Fetch()) {