Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call February 26, 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 Get Variable From Parent Url Or Parent Iframe?Sanitize All Scripts From Html StringWhy Does Inline-block And Max-width Not Work Together?How To Display The Last Field Which Is User Selected From Form Builder With The Field Name And Field Type? Post a Comment for "Code Hash Function Over Data In Form - Already Have Function But Don't Know Where To Call"