Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call June 22, 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 Call A Function From Another Html Page?How To Implement Lit-element-bootstrap Package In Lit-lementWhat Are Security Concerns Around Use Of Canvas.todataurl?Javascript Passing Click Event To Google Maps Through A Overlapping Div? Post a Comment for "Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call"