Copy a field value into another field on submit...

develum

New Member
I have two fields Email and Username, I would like the Email/username fields to be identical, meaning anyone who updates the Email address when the form is submitted the Username is updated as well.

I can make the Username field hidden, how would I go about changing it to the current email address if the email address has indeed changed?

-Eric
 
Hi Eric,

If you are doing this to let users login with email addresses... there are some Joomla extensions that allow for this here, but if not and to answer your question - add a php plugin to your form and set it to onBeforeProcess, then tweak the follwing php code to match your tables/fields and put it in the code box:

PHP:
$email = $formModel->formData['table___email'];
$formModel->updateFormData('table___username', $email, true);

Dale
 
Thanks Dale, I will try this code. It is sorta logging in with the email address, but if both of them are identical then this is kind of a non-issue. I'm already using Fabrik user linking to link the form with the people in the site.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top