Forums

Need help with concatenating form fields to save in database

4Summit 21 Jul, 2017
Hi,
I have a simple form that has name and 3 drop downs for year, month, and day for user date of birth. I want to concatenate the 3 values into a dob form value and only save name and dob in the database.

1) Based on the manual and other postings, i created the following custom code for dob (which is a hidden field in the form). i am not able to get the concatenation to work. What am I doing wrong?

var dbirth = {data:year}."-".{data:month}."-".{data:day};
{data.set:dob,dbirth};

Debugger O/P:

Array
(
[option] => com_chronoforms6
[chronoform] => user_registration
[event] => submit
[first_name] => Test
[last_name] => Again
[month] => 1
[day] => 1
[year] => 1975
[dob] =>
[Submit] =>
[Itemid] =>
[dob,dbirth] =>
)


2) How can I save just name and dob in the database? I provided {data:first name}, {data:last name}, {data:dob} in the data provider field, no columns get updated. If I just have {data:}, then all fields get updated (which I don;t want).

I am guessing the syntax for data provider is not right and i could find a working example anywhere. Please help.
Max_admin 31 Jul, 2017
Hi 4Summit,

Leave the data provider set to {data:} but in the "Data override" use the following:

name:{data:first_name} {data:last_name}
dob:{data:year}-{data:month}-{data:day}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
paula_ga 12 Feb, 2018
Hi,I need to do something similar.
Could you please tell me where to I write the following code?

title:{data:title} {data:first_name} {data:last_name}

Thank you very much for ansewring me.
Max_admin 12 Feb, 2018
Hi Paula,

This is for saving the data into the table, if your table has a field named "title" then you place that code in the "insert data override" box in the "Save data" settings

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}