combining 2 elements into a new element?

Maago

New Member
Hi all,

is it possible to combine 2 elements into 1 field for displaying in table view?
So question is how to calculate the result for displaying for example "Firstname" and "Lastname" are in different fields but in table view I want to show them in 1 column.

Marcus
 
What I usually do for stuff like that, whether it's Fabrik or any just building table driven apps in general, is create a "fullname" column on the fly when I save the table, and just use that to display the full name when I need it.

You could either use a form submit script, access $data[] directly and concat first and last names into $data['fullname'], or you could do it with JavaScript on form submit. Either way, have fullname as a hidden element on the form. Then on the table, just hide firstname and lastname, and only show fullname.

If you don't want to use an extra fullname element, you'll have to clone a template, and customize it to do the concatenation at table display time.

-- hugh
 
Assuming Fabrik 1.0.x, it'd be something like:

PHP:
$aData['table_name___fullname'] = $aData['table_name___first_name'] . " " . $aData['table_name___last_name'];

... using a 'before form is processed, simple eval' script.

-- hugh
 
I am using fabrik 2.0 and have issues combining 2 fields.
In the table submission plugin I run following php-code:

$formModel->updateFormData('jos_artists___Fullname_raw',{jos_artists___Firstname} . " " . {jos_artists___Lastname});return (true);

The issue is that if one of the fields is empty or a fields has a text including a blank the code crashes. Also special characters are missing, like:
firstname = "Mag."
lastname = "Wolfgang" will give a fullname like "MagWolfgang"

Any tipp how to improve this code?

thanks
Wolfgang
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top