open menu
window.myDemoApp ={ // a save function for my email input // will always be executed, but 3. input indicates if the inputValue is valid saveCustomerEmail : function(inputValue, $inputElement, isValidInput, isPageValidation){ console.error('saveCustomerEmail() ',inputValue, $inputElement, isValidInput, isPageValidation); //do your stuff here... }, // custom Validator function validateFullName : function($el, errormsg, isPageValidation){ console.error('input to validateFullName() ', $el.val()); // return true or false here. // you can also return an object with custom erromsg return { status : false, errormsg : 'Shit happens' } } }; // wait until document is done rendered before set up store and // update DOM with storedata $(document).ready(function(){ gj.store.setData({ fullname : "Donald Trumph" }, $('body')); });
Email:
// simple gj-form input setup (this is just a functional example ) // in real life you would use gjl.formline for this <div class="error-placeholder" style="display:flex"> <span>Email: </span> <input type="text" gj-form-validator="email" // build inn validator for email gj-form-errormsg = "email is invalid" //errormsg on element if email is invalid gj-form-mandatory = "true" //input MUST have valid email before user move on gj-form-mandatorymsg = "email is mandatory" //erromsg if input is left blank gj-form-save = "myDemoApp.saveCustomerEmail" //save function ></input> </div>
.