Skip to content

Instantly share code, notes, and snippets.

@jshaw
Created January 13, 2012 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jshaw/1606923 to your computer and use it in GitHub Desktop.
Save jshaw/1606923 to your computer and use it in GitHub Desktop.
fm-group-select sample to add groups to uploads
if ($('.groupSelectInputs').length > 0 ){
// declares the group string
var groupsString = "";
// Loops through all of the select inputs
$.each($('.groupSelectInputs'), function(i){
groupsString = groupsString == "" ? this.value : groupsString +','+ this.value;
});
// Convert the groups string to a readable array
groupsString = groupsString.split(',');
// Inserts the groups into the hidden input which is referenced when uploading
$('#groupHolder').val(groupsString);
}
<!-- Hidden input field to hold the group list -->
<input type="input" class="fmInput required" id="groupHolder" name="groupHolder" title="Select Group*" value="" />
<br />
<!-- Select 1 -->
<fm:Form_Select name="category" class="fmSelect groupSelectInputs">
<option>-- Select a category --</option>
<fm:GroupList
moderationStatus="{%var:moderationGroups}"
parentGroup="11223"
sort="{%gallery:groupSort}"
>
<fm:Loop>
<fm:Form_Option value="{$$group.id}" label="{$$group.name}" />
</fm:Loop>
</fm:GroupList>
</fm:Form_Select>
<!-- Select 2 -->
<fm:Form_Select name="category" class="fmSelect groupSelectInputs">
<option>-- Select a category --</option>
<fm:GroupList
moderationStatus="{%var:moderationGroups}"
parentGroup="11223"
sort="{%gallery:groupSort}"
>
<fm:Loop>
<fm:Form_Option value="{$$group.id}" label="{$$group.name}" />
</fm:Loop>
</fm:GroupList>
</fm:Form_Select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment