Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call March 11, 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 postsJson: 500 (internal Server Server Error) In .net Mvc3Asp:button In Jquery Dialog Box Not Firing Onclick EventUsing Fetch To Post Cross-origin Json Data To Express BackendRedirect The /upload Webpage (got From A Form-post Request In Node.js , Npm Package Multer) To Another Html Page Post a Comment for "Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call"