File modules/template_engine/components/html/component_checkbox/checkbox.min.js
Last commit: Thu Mar 10 13:09:06 2022 +0100 dankert New: Remember some user inputs in the browser local storage.
1 import $ from '../../../../cms/ui/themes/default/script/jquery-global.min.js'; 2 import Workbench from "../../../../cms/ui/themes/default/script/openrat/workbench.min.js"; 3 export default function(element ) { 4 $(element).find('.or-form-checkbox').change(function(e) { 5 this.nextElementSibling.value = this.checked ? '1' : '0'; 6 }); 7 $(element).find('.or-form-checkbox.or-remember').each( function() { 8 let key = 'preset.'+Workbench.state.action+'.'+this.dataset['name']; 9 if ( window.localStorage ) 10 this.checked = !!localStorage.getItem(key); 11 this.nextElementSibling.value = this.checked ? '1' : '0'; 12 }); 13 $(element).find('.or-form-checkbox.or-remember').change(function() { 14 let key = 'preset.'+Workbench.state.action+'.'+this.dataset['name']; 15 if ( window.localStorage ) 16 window.localStorage.setItem(key,this.checked?'1':''); 17 }); 18 };
Downloadmodules/template_engine/components/html/component_checkbox/checkbox.min.js
History Thu, 10 Mar 2022 13:09:06 +0100 dankert New: Remember some user inputs in the browser local storage. Wed, 9 Mar 2022 13:28:52 +0100 dankert Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()'