PDA

View Full Version : Form Submission



Lloyd K
23 Nov 2007, 4:47 AM
I'm writing a login window and when the form submits I need to pass up the password as an MD5 hash rather than plaintext, is there any way of intercepting the value BEFORE it gets sent using AJAX?

I was looking at the BasicForm.beforeaction() event however not sure if this is the right track?

Animal
23 Nov 2007, 5:20 AM
You could use a hidden field named using the correct password field name, and update it on change of the visible field (which would not have a name, and therefore not be submitted)

Lloyd K
23 Nov 2007, 6:25 AM
Hi Animal,

I tried what you said, however the password field is still submitted (regardless of having a name or not) :(

Lloyd K
23 Nov 2007, 7:13 AM
So the solution at the moment is on submission I store the plain password in variable and lock the controls before switching the password to the MD5 version and submitting, when the submission returns I switch the passwords back and unlock the controls.

Not pretty and elegant but it works at least :)

Animal
23 Nov 2007, 9:05 AM
Hi Animal,

I tried what you said, however the password field is still submitted (regardless of having a name or not) :(


You're not using prototype are you?

Because the Ext adapter's Ext.lib.Ajax.serializeForm has



if (!disabled && name){


Which means that when it serializes the form, fields with no name are not submitted.

Lloyd K
23 Nov 2007, 2:49 PM
I'm using RC1 as available from the website.

Animal
24 Nov 2007, 1:22 AM
With what adapter?

Lloyd K
26 Nov 2007, 1:10 AM
Hmmm, "[ext2]/adapter/ext/ext-base.js" I think.