Hi,
in your form you not have any field with id like cmc_groups_FNAME, cmc_groups_LNAME or cmc_groups_EMAIL, all these input have following ids:
- jform_cmc_groups_FNAME
- jform_cmc_groups_LNAME
- jform_cmc_groups_EMAIL
so you need to add "jform_" before id like
document.getElementById('jform_cmc_groups_FNAME').value = jQuery('input[name="jform[firstname]"]').val();
document.getElementById('jform_cmc_groups_LNAME').value = jQuery('input[name="jform[lastname]"]').val();
document.getElementById('jform_cmc_groups_EMAIL').value = jQuery('input[name="jform[email1]"]').val();
or in order to use jQuery framework like this:
jQuery('#jform_cmc_groups_FNAME').val(jQuery('input[name="jform[firstname]"]').val());
jQuery('#jform_cmc_groups_LNAME').val(jQuery('input[name="jform[lastname]"]').val());
jQuery('#jform_cmc_groups_EMAIL').val(jQuery('input[name="jform[email1]"]').val());
Another Important Tip:
to fill these fields you use event like $('#jform_password2').click(), this cause 2 problems:
1. "$" var can be some other framework, so we recommend to use "jQuery"
2. event is triggered only when you "click" on password2 field, but this not works when you use keyboard
3. this event is not attacked to password field because it is not loaded when your code execute, you need to include this into some events like jQuery(document).ready
4. if you fill password2 and after email,name and lastname this code not fill informations, because when you fill password2 all others fields are empty, the best way is to attach events when you click submit button
Solution can be to use some code like this
jQuery(document).ready(function(){
jQuery('#member-registration [type="submit"]').click(function(){
jQuery('#jform_cmc_groups_FNAME').val(jQuery('input[name="jform[firstname]"]').val());
jQuery('#jform_cmc_groups_LNAME').val(jQuery('input[name="jform[lastname]"]').val());
jQuery('#jform_cmc_groups_EMAIL').val(jQuery('input[name="jform[email1]"]').val());
});
});