Forums

Combine Firstname and Lastname fields to Name in Joomla Registration form

ralph024 13 Jun, 2016
Hi,

i would like to combine the first and lastname in the joomla registration.
I already tried this topic: https://www.chronoengine.com/forums/posts/t95020/p326124/combine-firstname-and-lastname-fields-to-name-in-joomla-registration-form.html

But this doesnt work in Chronoforms V5


Thanks
GreyHead 13 Jun, 2016
Hi ralph024,

That should work in CFv5 OK.

Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Bob
ralph024 13 Jun, 2016
Hi Bob,

here are the results of the Debugger:

Array
(
    [chronoform] => registration_user
    [event] => submit
    [username] => ralph123456
    [pass1] => Welkom0123
    [pass2] => Welkom0123
    [email] => info@domain_name.nl
    [firstname] => Ralph
    [lastname] => van Kessel
    [country] => Netherlands
    [entity] => 800
    [button6] => Submit
    [name] => van Kessel
    [password] => Welkom0123
    [password2] => Welkom0123
    [_PLUGINS_] => Array
        (
            [joomla_registration] => Array
                (
                    [*isRoot] => 
                    [id] => 585
                    [name] => van Kessel
                    [username] => ralph123456
                    [email] => info@domain_name.nl
                    [password] => $2y$10$W/jYRQ596AOCVljan/iAouJe3zWdWlScD.roz6zXX/JnqGpPP2xWW
                    [password_clear] => Welkom0123
                    [block] => 0
                    [sendEmail] => 0
                    [registerDate] => 2016-06-13 13:22:14
                    [lastvisitDate] => 2016-06-13 10:06:57
                    [activation] => 
                    [groups] => Array
                        (
                            [0] => 14
                        )

                    [lastResetTime] => 0000-00-00 00:00:00
                    [resetCount] => 0
                    [requireReset] => 0
                    [*_params] => Joomla\Registry\Registry Object
                        (
                            [data:protected] => stdClass Object
                                (
                                    [admin_style] => 
                                    [admin_language] => 
                                    [language] => 
                                    [editor] => 
                                    [helpsite] => 
                                    [timezone] => 
                                )

                            [separator] => .
                        )

                    [*_authGroups] => Array
                        (
                            [0] => 1
                            [1] => 2
                            [2] => 12
                        )

                    [*_authLevels] => Array
                        (
                            [0] => 1
                            [1] => 1
                            [2] => 2
                            [3] => 6
                        )

                    [*_authActions] => 
                    [*_errorMsg] => 
                    [*userHelper] => JUserWrapperHelper Object
                        (
                        )

                    [*_errors] => Array
                        (
                        )

                    [aid] => 0
                    [otpKey] => 
                    [otep] => 
                    [chronoform] => registration_user
                    [event] => submit
                    [pass1] => Welkom0123
                    [pass2] => Welkom0123
                    [firstname] => Ralph
                    [lastname] => van Kessel
                    [country] => Netherlands
                    [entity] => 800
                    [button6] => Submit
                    [password2] => Welkom0123
                    [usertype] => deprecated
                )

        )

)


Array
(
)


Errors:
Array
(
)


Debug info:
Array
(
)



Thanks
GreyHead 13 Jun, 2016
Hi Ralph,

Nothing there to explain the problem. What code exactly do you have in the Custom Code action?

Bob
ralph024 13 Jun, 2016
Hi Bob,

is used the following code:

<?php $new_data =  JRequest::getVar('firstname').JRequest::getVar('lastname');
JRequest::setVar('name', $new_data);
?>


Thanks!
Ralph
GreyHead 13 Jun, 2016
Hi Ralph,

If you had scrolled down a couple more posts you would have found the correct code:
<?php
$form->data['name'] = "{$form->data['firstname']} {$form->data['lastname']}";
?>

Bob
ralph024 13 Jun, 2016
Hi Bob,

Thanks and you were right! 😶
I didnt see the other posts with the correct code...

One other question, do you know if i can store some extra information from my chronoform registration form into the Joomla user profile? As Country and Entity?

Thanks!
GreyHead 13 Jun, 2016
Hi Ralph,

Yes . . . but you have to do it with Custom Code to create/update the profile records. I found an example in this StackOverFlow answer

Bob
ralph024 15 Jun, 2016
Hi Bob,

Thanks again! And i will try to create a custom code to create/update profile settings

Ralph
This topic is locked and no more replies can be posted.