T
T
Thores2015-02-16 21:02:01
PHP
Thores, 2015-02-16 21:02:01

How to duplicate the value of an input into another hidden input?

And so, I have a Joomla registration form.
The goal is to simplify the form. Enter e-mail and password + password confirmation.
Therefore, you need to use e-mail as a login, and this is the problem, because the form does not work without a field with the username parameter.
It would seem that the code below will solve everything.

<input type="email" id="email" value="" onkeyup="$('#username').val(this.value);"/>
Эти скрытое поле, куда нужно дублировать введенные данные из верхних инпутов.
<input type="hidden" id="username" name="username" value="" />

But the inputs themselves in Joomle are displayed according to this pattern
<?php echo $this->form->getField('email')->input; ?>

How can I solve this problem? With the help of what script or what manipulations? What would it be like to just duplicate the value and submit it when the form is submitted? Or maybe there are some other ways to solve my problem?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
Oleg Titarenko, 2015-02-17
@Thores

Then you need to change the selection in the database in the authorization module. You can't decide otherwise. No need to climb through the window, tell the script what you want to find under the field.
Or Jquery as a function..

function keyword() {
 $("id").val() ....
}

Z
Zlatoslav Desyatnikov, 2015-02-16
@pxz

Do not onkeyup, but onchange.

A
Andrey, 2015-02-16
@standy

If you cannot add an attribute to the input, but really want to, then put it in a separate script tag.

<script>
$('#email').on('keyup', function() {
  $('#username').val(this.value);
});
</script>

T
Thores, 2015-02-16
@Thores

This approach doesn't help. I mean, even in the source code it is not displayed. Dear, tell me, is there any other solution to the issue of brief registration besides third-party extensions?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question