Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call October 17, 2022 Post a Comment I have form in my html page Copy JavaScript function myOnSubmit(aForm) { //Getting the two input objects var inputUsername = aForm['username']; var inputPassword = aForm['password']; //Hashing the values before submitting inputUsername.value = sha256_hash(inputUsername.value); inputPassword.value = sha256_hash(inputPassword.value); //Submitting return true; } Copy EDIT : Because of the 'Hashing the values before submitting' part, it will not work if you have a maxlength property, because hashed values are much longer than just the clear password. If you MUST use a maximum length, then you would need to implement HIDDEN FIELDS and changing those values, and making sure the fields containing the clear data aren't submitted (outside of the <FORM> tag). Solution 2: <button dojoType="dijit.form.Button" class="soria" style="border: 1px solid black; float:right;" type="submit" onclick="username.value=sha256_hash(username.value);password.value=sha256_hash(password.value)">Login</button></td> Copy Generally when you send sensitive data, you have only to worry about password, so you can hash password and leave user as it. Share You may like these postsCode Hash Function Over Data In Form - Already Have Function But Don't Know Where To CallAndroid And Php Creating An ApiHow To Retrieve Custom Html Attribute In Php Post?Post Newline/carriage Return As Hidden Field Value Post a Comment for "Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call"