Difference between revisions of "Auto select single group membership type"

From UnionCloud Support
Jump to: navigation, search
(Page creation)
 
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
 
The following code snippet, which should be put in Global Javascript, will automatically select the membership type if there is only one membership type listed on the page.
 
The following code snippet, which should be put in Global Javascript, will automatically select the membership type if there is only one membership type listed on the page.
  
  <nowiki>
+
  <syntaxhighlight lang="javascript" line='line'>
 
$(function() {
 
$(function() {
 
     if (window.location.pathname.substring(window.location.pathname.length - 5) == '/join' || window.location.pathname.substring(window.location.pathname.length - 5) == 'join/') {
 
     if (window.location.pathname.substring(window.location.pathname.length - 5) == '/join' || window.location.pathname.substring(window.location.pathname.length - 5) == 'join/') {
Line 11: Line 11:
 
     }
 
     }
 
});
 
});
</nowiki>
+
</syntaxhighlight>

Latest revision as of 15:08, 29 March 2017

When a student joins a group, they have to select a membership type for the group. When there is only a single membership type for the group, the platform still requires the student to select it.

The following code snippet, which should be put in Global Javascript, will automatically select the membership type if there is only one membership type listed on the page.

1 $(function() {
2     if (window.location.pathname.substring(window.location.pathname.length - 5) == '/join' || window.location.pathname.substring(window.location.pathname.length - 5) == 'join/') {
3         if ($('.memberShipType').length == 1) {
4         	$('.memberShipType').click();
5         }
6     }
7 });