aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Changing A Form Field Value On Submit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Changing A Form Field Value On Submit" Watch "Changing A Form Field Value On Submit" New topic
Author

Changing A Form Field Value On Submit

Jason Ferguson
Ranch Hand

Joined: Aug 09, 2007
Posts: 58
I am attempting to make my application login slightly more secure by hashing a password via javascript to sha-256 BEFORE sending it to the server.

So, the user puts their password into a password field:

<input type="password" name="userPassword" id="userPassword" />

On submit, I need to run the sha_256 function on userPassword, then submit. So, I need a javascript function to fire off on the form's onSumit action.

This is probably simple, but I'm not sure. Can someone help?

Jason
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
Something like this should do the trick:


Ping & DNS - updated with new look and Ping home screen widget
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
yep,

what you can do is just have the type of input just be a button instead of a submit, then you can just assign your hashfunction to the onclick method of that button input.

then after you hash and all that stuff in your function, just use the .submit() function like so.



it's either .submit or .submit() can't remember off hand.

Justin Fox


You down with OOP? Yeah you know me!
Jason Ferguson
Ranch Hand

Joined: Sep 16, 2007
Posts: 47
Thanks guys. I hadn't done anything like this in awhile, and had totally forgotten how to do it.

Unfortunately, it doesn't solve the debate whether hashing on the client side and passing the hash makes the app any more secure.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
I'd probably use SSL to make a secure connection instead of using hashs. If the password seems worth securing, then so should the actual data.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing A Form Field Value On Submit
 
Similar Threads
Validator Framework and Javascript
inputHidden causing conversion problems
Javascript submit problem
using ajax to populate select box
using the hidden value fields