Forums

Retrieve id of record registered

NiLu 02 Apr, 2014
Hello everyone and heartfelt congratulations .....
I would like to take advantage of some of your wisdom and wonder how it is possible to do things ....

1 ) I created a multipage form with ChronoForms , thanks to your guide I was able to do, since I would need that for every form filled there is a unique code ( type ID that is created in the database ) to be sent to the person who filled out the form, I tried to bring up the unique code in your confirmation (by putting {id }) but the same does not go out , probably because the bike when I send the email the db is not read but written ....
I want to know is there any function that can generate a unique code , or you can read the id in the db to be able to send to those who filled out the form ?

2 ) always in the email receipt sent to the person who fills out the form , I need to let out the date of issue , I tried to put in a hidden field datepicker BOX to set default today's date and then call it in ' email, but was not able to set the date .... Can you tell me how to set it or if there is no other solution?

3 ) once filled in the form , I have a summary page where you can choose to pay by paypal or bank ...
how can I redirect the user to page in onsubmit paypal or bank depending on the choice made by Radio Box ?

4 ) How can I redirect the user on submit to an article or another form ?

thanks and sorry for the english, I'm Italian ...
GreyHead 03 Apr, 2014
Hi NiLu,

1) Please see this FAQ for the ID.

2) Add a Custom Code action with this code in it before the Email action:
<?php
$form->data['date'] = date('y-m-d');
?>
and add {date} to the Email template.

3) Use the Event Switcher action (I think that there is one in CFv5|)

4) Use the ReDirect action.

Bob

Later: corrected typo
NiLu 03 Apr, 2014
thanks for the reply gray
3) How do I set the action Event Switcher?
I have a radio box where you can choose the type of payment with id Modalita_Pagamento
if you choose paypal at www.paypal.com I have to redirect, and if you choose bank transfer I have to redirect to a file in folder of joomla

4) to redirect to another form, with the action redirect, asked me the URL, where I'll take it to the form?
Max_admin 03 Apr, 2014
#3- https://www.chronoengine.com/faqs/70-cfv5/5212-event-switcher.html

#4- Just copy it from the "View form" link in the forms manager!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 03 Apr, 2014
okkkkkkk ... only for points 1 and 2 can not
I did what you told me but nothing bob
NiLu 03 Apr, 2014
I put the Custom Code as in photo 1 and the code
<?php
$form->data['date'] = date(d-m-y');
?>

while email settings as in photo 2 {date} and
$form->data['pra_telaio']['cf_id'] 
(pra_telaio) is the name of my database, but I do not see email id and date
GreyHead 04 Apr, 2014
Hi NiLu,

Have you tried using the Event Switcher action? It looks straight-forward to me.

To ReDirect you add the URL you want to go to into the ReDirect action.

Bob
NiLu 04 Apr, 2014
yes, thanks
Steps 3 and 4 are solved
I can not with points 1 and 2
Max_admin 04 Apr, 2014
#2- the code has a 1 missing quote, it should be:
<?php
$form->data['date'] = date('d-m-y');
?>


#1- You could also use {pra_telaio.cf_id} in the email template, but unfortunately the db save in v5 doesn't load the latest record id in the data array yet, so you will need to add a "custom code" action after the db save and use this code:

$form->data['pra_telaio']['id'] = \GCore\Libs\Model::getInstance()->pra_telaio->id;


Assuming your model id in the db save is "pra_telaio"

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 05 Apr, 2014
Max thanks for interest, the date I solved but I can not fix id.
I entered the custom code after the db and save the email template I have included
{id}
{cf_id}
{pra_telaio.cf_id}
{pra_telaio.id}
but no one gives me result
I enclose also debugging where we see that when I send the form, before starting debugging, it gives me the code I have for reinserting id.
Max_admin 05 Apr, 2014
The 2nd line of code should be inside php tags:
<?php
$form->data['pra_telaio']['id'] = \GCore\Libs\Model::getInstance()->pra_telaio->id;
?>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 06 Apr, 2014
I copied the code into the custom code after DB save but exit error SQL=DESCRIBE ``
NiLu 06 Apr, 2014
but I write in the email template {id}?
NiLu 06 Apr, 2014
I'm sorry, but going forward with the site there are other problems ....
when in action Display Message recall a checkbox} {check1 if this is checked by the value given me, but if it is not checked out check1 {}
I want that if it is not checked out no value.
in email is ok, nothing comes out, the problem is only in action Display Message

please help me, these two things after I completed the site
NiLu 07 Apr, 2014
id resolved
I inserted the code
<?php
$db =& JFactory::getDBO();
$form->data['id'] = GCore\Models\Data::getInstance()->id;
?>

where Data is my id model in dbsave
there remains only the problem of xhe checkbox when not selected display message out {check1}.
Max_admin 07 Apr, 2014
Answer
Good, the checkbox issue would need the field ghost feature, which is not yet ready in v5, so we will need a custom code action before the "Email" action with this code:

<?php
if(!isset($form->data["check1"]))$form->data["check1"] = "";
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 07 Apr, 2014
Perfect....
if you want you can help me again ...
how do I make one texbox required only when it is visible?
example
When I checked a checkbox opens a texbox and should become required, but when it is closed it is not required
Max_admin 07 Apr, 2014
The required status should be auto disabled when the field is not visible, but this fix is not available in the public version yet, you may send me a message using the "contact us" page to get the patch!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 07 Apr, 2014
ok, the message sent
NiLu 07 Apr, 2014
I install this and it is ok?
Max_admin 07 Apr, 2014
Yes, after the install just clear your browser's cache and it should work fine!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 07 Apr, 2014
No, when I click on send does not go forward if I fail to complete the hidden fields
Max_admin 07 Apr, 2014
Did you clear your browser's cache ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 07 Apr, 2014
yes, I also tried from another PC.
NiLu 07 Apr, 2014
nothing, I'm trying but nothing changes by installing the cegcore
Max_admin 07 Apr, 2014
I have sent you the file again now!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NiLu 08 Apr, 2014
perfect, everything is ok
thank you very much
if you want to see the site is www.nonsolovisure.it
it is also because of you that are online.
This topic is locked and no more replies can be posted.