Forums

Combine Fields for Registration

csteele 17 Dec, 2012
I would like to capture a user's first name and last name in separate fields, but then combine them into a single value for use in the Joomla registration action. Is this possible and if so how?
GreyHead 18 Dec, 2012
HI csteele,

Please see this FAQ you can use exactly the same method before the DB Save action.

Bob
csteele 18 Dec, 2012
Thanks! I'm not sure I know how to use that, but here are my thoughts, please correct me:

I created the form in wizard mode so I open the form and then on the "Code" tab, do I simply paste in the PHP code and if so, where and if so, do I need to change the code from "Wizard" to "Custom"?

My resulting code would look like this:

<div class="ccms_form_element cfdiv_text" id="first_name1_container_div" style=""><label>First Name</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="first_name" />
<div class="clear"></div><div id="error-message-first_name"></div></div><div class="ccms_form_element cfdiv_text" id="last_name1_container_div" style=""><label>Last Name</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="last_name" />
<div class="clear"></div><div id="error-message-last_name"></div></div><div class="ccms_form_element cfdiv_text" id="username1_container_div" style=""><label>Username</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="username" />
<div class="clear"></div><div id="error-message-username"></div></div><div class="ccms_form_element cfdiv_text" id="email1_container_div" style=""><label>Email</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="email" />
<div class="clear"></div><div id="error-message-email"></div></div><div class="ccms_form_element cfdiv_text" id="password1_container_div" style=""><label>Password</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="password" />
<div class="clear"></div><div id="error-message-password"></div></div><div class="ccms_form_element cfdiv_text" id="password_confirm1_container_div" style=""><label>Confirm</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="password_confirm" />
<div class="clear"></div><div id="error-message-password_confirm"></div></div><div class="ccms_form_element cfdiv_submit" id="input_submit_61_container_div" style="text-align:left"><input name="input_submit_6" class="" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_6"></div></div>
<?php
$form->data['name'] = "{$form->data['first_name']} {$form->data['last_name']}";
?>
GreyHead 18 Dec, 2012
Hi csteele,

No, not at all.

Drag a Custom Code action into the On Submit event and move it before the Email action. Open the Custom Code action and add code like this:

If you are using the Easy Wizard then there's a Custom PHP Code tab under the Others tab.

Bob
csteele 18 Dec, 2012
Thanks, that did it!
This topic is locked and no more replies can be posted.