Elgg  Version 2.2
Functions
useradd.js File Reference

Go to the source code of this file.

Functions

 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));});})
 

Function Documentation

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));});}  )
Parameters
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(){.prop('required', false);.closest('.elgg-field').addClass('hidden');});}else{$('[name="password"],[name="password2"]', $form).each(function(){.prop('required', true);.closest('.elgg-field').removeClass('hidden');});}}.on('change', checkbox_selector, function(){togglePasswordInput();});require(['elgg/ready'], function(){togglePasswordInput();});} Toggle password input visibility based on the value of the autogenerate password checkbox
{jQuery}$checkbox Checkbox input
Returns
{void}