Combine Firstname and Lastname fields to Name in Joomla Registration form

profotoweb 08 Mar, 2014
Hi,

Tried to find a simple answer that include all the steps to combine / concatenate two fields in a Chronoforms Joomla registration form.

'Firstname' 'Lastname' should form 'Name' (with space in between)(Since joomla only use full name and don't separate these)

[list]I have created the fields, including a hidden field for 'name'
I have tried to place "Custom code" before the Joomla Registration event in "On Submit"[/list]
<?php $new_data =  JRequest::getVar('firstname').JRequest::getVar('lastname');
JRequest::setVar('name', $new_data);
?>

[list]I have set the Joomla Registration Event parameter "name" to field name.
The form is saying "You must provide your username" on Submit[/list]

Where do I go wrong?
profotoweb 08 Mar, 2014
Perfect! Thnx!

For anyone else:
1. Create hidden field 'name' in your form under "Preview"
1a. Also create 'firstname' and 'lastname' fields in "Preview"
2. Create a 'Custom Code' element under "Actions" -
Place in OnSubmit event block - After any Captcha but before "Joomla Registration" element
2a. Insert the following in your "Custom Code" element:
<?php
$form->data['name'] = "{$form->data['firstname']} {$form->data['lastname']}";
?>


/Akerman
GreyHead 08 Mar, 2014
Hi /Akerman,

Just to be technically correct you don't need 1. the hidden 'name' input, it does no harm but the process will work OK without it.

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