Hi Bob,
I create a form with tree combo fields, one for day, one for month, one for year.
I used this solution because I had some issue on mobile.
Now my problem is... how to combine the three field in one named "birthday" that will be saved on db?
In PHP I can use a solution like that, but how in chronoform?
I create a form with tree combo fields, one for day, one for month, one for year.
I used this solution because I had some issue on mobile.
Now my problem is... how to combine the three field in one named "birthday" that will be saved on db?
In PHP I can use a solution like that, but how in chronoform?
$birthday = $year . "-" . $month . "-" . $day;
Hi indiana71,
You can use a PHP action in the form On Submit event to create a new data item. Pleaes see page 34 of the CFv6 manual.
Bob
You can use a PHP action in the form On Submit event to create a new data item. Pleaes see page 34 of the CFv6 manual.
Bob
Thanks, and to save it on db?
Can I use an hidden field? and mark the single one as "no save", "no email"?
Can I use an hidden field? and mark the single one as "no save", "no email"?
Hi indiana71,
Once you have added 'birthday' to the form data you can save it with a Save Data action like any other form data.
Can I use an hidden field? and mark the single one as "no save", "no email"?
Sorry, I don't understand what you are asking here :-(
Bob
Once you have added 'birthday' to the form data you can save it with a Save Data action like any other form data.
Can I use an hidden field? and mark the single one as "no save", "no email"?
Sorry, I don't understand what you are asking here :-(
Bob
Thanks Bob. Don't care for the second question. You just answer me!
Meanwhile I used another solution. I don't know if it is less efficient, but it works.
I left here for some other people that need it.
I put a Javascript and a custom hidden field named "birthday" on my form.
Inside Javascript (flagged 'Add Inside domready event') I put this code:
#birthday and #birthmonth are two combo fields with values (01, 02, 03, ...10, 11...)
#birthyear is another combo that recall a php function in setup section
Meanwhile I used another solution. I don't know if it is less efficient, but it works.
I left here for some other people that need it.
I put a Javascript and a custom hidden field named "birthday" on my form.
Inside Javascript (flagged 'Add Inside domready event') I put this code:
$("#birthday,#birthmonth,#birthyear").on("change", function(){
$("#datebirth").val( $("#birthyear").val() + "-" + $("#birthmonth").val() + "-" + $("#birthday").val() );
});
#birthday and #birthmonth are two combo fields with values (01, 02, 03, ...10, 11...)
#birthyear is another combo that recall a php function in setup section
{var:latest_100_years}developed as follow:
$years = array_combine(range(date("Y"), 1900), range(date("Y"), 1900));
return $years;
OR just put the following in your save data action
birthday:{data:birthyear}-{data:birthmonth}-{data:birthday}
Hi Bob,
I used Javascript solution for a long but sometime data field save on db blank. I think that some browser don't work javascript well.
Now I'm trying to switch to PHP solution.
I use review page before submit to database.
On review page I can view datas. I added the following PHP code on review and it work
/*
$this->data['datebirth'] = $this->data['birthyear'] . "-" . $this->data['birthmonth'] . "-" . $this->data['birthday'];
$this->data['passportissue'] = $this->data['pass_whenIssuedYear'] . "-" . $this->data['pass_whenIssuedMonth'] . "-" . $this->data['pass_whenIssuedDay'];
$this->data['passportexpiry'] = $this->data['pass_expirationYear'] . "-" . $this->data['pass_expirationMonth'] . "-" . $this->data['pass_expirationDay'];
*/
$this->data("datebirth", $this->data['birthyear'] . "-" . $this->data['birthmonth'] . "-" . $this->data['birthday'], true);
$this->data("passportissue", $this->data['pass_whenIssuedYear'] . "-" . $this->data['pass_whenIssuedMonth'] . "-" . $this->data['pass_whenIssuedDay'], true);
$this->data("passportexpiry", $this->data['pass_expirationYear'] . "-" . $this->data['pass_expirationMonth'] . "-" . $this->data['pass_expirationDay'], true);
On submit page I lost datebirth, passportissue and passportexpiry.
I tryed also to insert
Data wont save on DB.
Help!
I used Javascript solution for a long but sometime data field save on db blank. I think that some browser don't work javascript well.
Now I'm trying to switch to PHP solution.
I use review page before submit to database.
On review page I can view datas. I added the following PHP code on review and it work
/*
$this->data['datebirth'] = $this->data['birthyear'] . "-" . $this->data['birthmonth'] . "-" . $this->data['birthday'];
$this->data['passportissue'] = $this->data['pass_whenIssuedYear'] . "-" . $this->data['pass_whenIssuedMonth'] . "-" . $this->data['pass_whenIssuedDay'];
$this->data['passportexpiry'] = $this->data['pass_expirationYear'] . "-" . $this->data['pass_expirationMonth'] . "-" . $this->data['pass_expirationDay'];
*/
$this->data("datebirth", $this->data['birthyear'] . "-" . $this->data['birthmonth'] . "-" . $this->data['birthday'], true);
$this->data("passportissue", $this->data['pass_whenIssuedYear'] . "-" . $this->data['pass_whenIssuedMonth'] . "-" . $this->data['pass_whenIssuedDay'], true);
$this->data("passportexpiry", $this->data['pass_expirationYear'] . "-" . $this->data['pass_expirationMonth'] . "-" . $this->data['pass_expirationDay'], true);
On submit page I lost datebirth, passportissue and passportexpiry.
I tryed also to insert
birthday:{data:birthyear}-{data:birthmonth}-{data:birthday}into savedata action, but nothing!
Data wont save on DB.
Help!
What does the {debug:} say?
Data empty..
I found the solution, I hope.
Passing through a form to another I need to fill again the data fields. The system lost them.
So I added another PHP Action with same code of review page to submit page.
I found the solution, I hope.
Passing through a form to another I need to fill again the data fields. The system lost them.
So I added another PHP Action with same code of review page to submit page.
You should be using the multi page action
Then unless you tick the mix with data button, you need to use {session.multipage:field}
This topic is locked and no more replies can be posted.