Elgg  Version 2.3
useradd.js
Go to the documentation of this file.
1 define(function(require) {
2 
3  var $ = require('jquery');
4 
5  var checkbox_selector = 'input[type="checkbox"][name="autogen_password"]';
6 
14  function togglePasswordInput($checkbox) {
15  var $form = $checkbox.closest('.elgg-form-useradd');
16  if (!$form.length) {
17  return;
18  }
19  if ($checkbox.is(':checked')) {
20  $('[name="password"],[name="password2"]', $form).each(function() {
21  $(this).prop('required', false);
22  $(this).closest('.elgg-field').addClass('hidden');
23  });
24  } else {
25  $('[name="password"],[name="password2"]', $form).each(function() {
26  $(this).prop('required', true);
27  $(this).closest('.elgg-field').removeClass('hidden');
28  });
29  }
30  }
31 
32  $(document).on('change', checkbox_selector, function() {
33  togglePasswordInput($(this));
34  });
35 
36  require(['elgg/ready'], function() {
37  togglePasswordInput($(checkbox_selector));
38  });
39 });
40 
41 
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on
Definition: GPL-LICENSE.txt:43
$form
Definition: settings.php:18
elgg require
Throw an error if the required package isn't present.
Definition: elgglib.js:164
GNU GENERAL PUBLIC LICENSE June Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license document
Definition: GPL-LICENSE.txt:4
define(function(require){var $=require('jquery');var checkbox_selector= 'input[type="checkbox"][name="autogen_password"]';function togglePasswordInput($checkbox){var $form=$checkbox.closest('.elgg-form-useradd');if(!$form.length){return;}if($checkbox.is(':checked')){$('[name="password"],[name="password2"]', $form).each(function(){$(this).prop('required', false);$(this).closest('.elgg-field').addClass('hidden');});}else{$('[name="password"],[name="password2"]', $form).each(function(){$(this).prop('required', true);$(this).closest('.elgg-field').removeClass('hidden');});}}$(document).on('change', checkbox_selector, function(){togglePasswordInput($(this));});require(['elgg/ready'], function(){togglePasswordInput($(checkbox_selector));});})