/    Sign up×
Community /Pin to ProfileBookmark

Select Multiple on Form Dropdown

I need some assistance changing a single select into a multiple select form drop-down. I am having issues with the multiple selections storing. The function loops through all of the users and assigns a drop-down where I can select the folder they have access to. I’m not having any luck trying to assign more than one folder to each user. Thank you for your help!

[code=php]$var = ”
<script type=’text/javascript’>
jQuery(function(){

jQuery(‘form’).attr(‘method’, ‘get’);
jQuery(‘form’).after(‘<input type=”submit” id=”doaction_k2″ class=”button-secondary action” value=”Apply Folder Access” style=”background: red; color: #fff;”>’);

var thisurl = ”;
var thaturl = ”;
jQuery(‘#doaction_k2’).live(‘click’, function(){
jQuery(‘.new_file_access’).each(function(){
thisurl = thisurl + ‘|’ + jQuery(this).attr(‘userid’) + ‘~’ + jQuery(this).val();
});

jQuery(‘.new_file_readwrite’).each(function(){
thaturl = thaturl + ‘|’ + jQuery(this).attr(‘userid’) + ‘~’ + jQuery(this).val();
});

jQuery.post(document.URL, { update_access: 1, file_access: thisurl, file_readwrite: thaturl }, function(){
window.location = document.URL;
});

return false;
});
});

</script>”;
}

$var .= “<select multiple=’yes’ id=’file_manager_accessk”.$user_id.”‘ class=’new_file_access’ userid=’$user_id’><option value=” $noaccess>No Access</option>”;

foreach($ACCESS_ARRAY as $key=>$value)
{
$key = str_replace(‘\’, ‘/’, $key);
$keys = $key .’~’. $urls.’/’.$value;
$keys = substr($keys, 0, strlen($keys)-1);
$keys1 = base64_encode($keys);

$var .= “<option value=’$keys1′ $select[$keys]>$value</option>”;
}
$var .= “</select>”;
return $var;
break;[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 17.2013 — I'm guessing we'll need to see where/how $ACCESS_ARRAY is assigned its values.
Copy linkTweet thisAlerts:
@sarahb12authorSep 17.2013 — Here is the array of folders that are assigned to $ACCESS_ARRAY. Thanks!

[code=php]$ACCESS_ARRAY = array(1=>'All Files', 2=>'wp-admin', 3=>'wp-content', 4=>'wp-includes', 5=>'plugins', 6=>'themes', 7=>'None');[/code]

I'm guessing we'll need to see where/how $ACCESS_ARRAY is assigned its values.[/QUOTE]
×

Success!

Help @sarahb12 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.7,
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,
)...