Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call April 20, 2024 Post a Comment I have form in my html page <formonsubmit="return myOnSubmit(this);">CopyJavaScriptfunctionmyOnSubmit(aForm) { //Getting the two input objectsvar inputUsername = aForm['username']; var inputPassword = aForm['password']; //Hashing the values before submitting inputUsername.value = sha256_hash(inputUsername.value); inputPassword.value = sha256_hash(inputPassword.value); //Submittingreturntrue; } CopyEDIT : 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> CopyGenerally 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 postsHow To Use Javascript To Turn Off Html5 Audio When Checkbox Is Unchecked?Jquery Datatable Pagination Not AppearingWhy Am I Getting The Js Error In Line One Of My Script Syntax Error: Invalid Or Unexpected Token?Error In Internet Explorer 9 (not Earlier Versions Or Other Browsers) When Including Jquery In An Iframe Post a Comment for "Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call"