Hi!
I'm trying to do an e-mail verification in my form. I've got 3 additional posistions in database uid, check_uid and verified. I also added verify event . In custom code I create an unique id and assign it to uid. In e-mail to user I send a link:
<a href='http://mysite.com/index.php?option=com_chronoforms5&chronoform=form_name&event=verify&check_uid={uid}' >Click to verify</a>
Then in a verify event I want to assign check_uid to proper record, but CF creates a new one with only this field filled.
I have DB Read and DB Save in on found event inside. I suppose that I have to add some update conditions in DB Save, but no idea what code should it be.
How to repair it?
Thank you in advance, and sorry for my English,
Mieszko
I'm trying to do an e-mail verification in my form. I've got 3 additional posistions in database uid, check_uid and verified. I also added verify event . In custom code I create an unique id and assign it to uid. In e-mail to user I send a link:
<a href='http://mysite.com/index.php?option=com_chronoforms5&chronoform=form_name&event=verify&check_uid={uid}' >Click to verify</a>
Then in a verify event I want to assign check_uid to proper record, but CF creates a new one with only this field filled.
I have DB Read and DB Save in on found event inside. I suppose that I have to add some update conditions in DB Save, but no idea what code should it be.
How to repair it?
Thank you in advance, and sorry for my English,
Mieszko
Hello mieszko,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How to load record data from a database table into your form
How can I edit a record from a database table?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How to load record data from a database table into your form
How can I edit a record from a database table?
P.S: I'm just an automated service😉
Hi Mieszko,
I think that you need to add code in the Conditions box of the DB Save like this
Bob
I think that you need to add code in the Conditions box of the DB Save like this
<?php
return array('check_uid' => $form->data['check_uid']);
?>
That should identify the record with the matching uid
Bob
Hi Bob,
thank you for your help, but it still doesn't work. When I added this code to update conditions, the check_uid field is not added to any record.
Maybe some screenshots will bu useful:
thank you for your help, but it still doesn't work. When I added this code to update conditions, the check_uid field is not added to any record.
Maybe some screenshots will bu useful:
Hi Mieszko,
I'm rather lost about the purpose of this.
The reason that uid is being updated is that you have the data in $form->data['uid'] - if you want to save that to check_uid then you need to copy the data
Bob
I'm rather lost about the purpose of this.
The reason that uid is being updated is that you have the data in $form->data['uid'] - if you want to save that to check_uid then you need to copy the data
<?php
$form->data['uid'] = $form->data['check_uid'];
?>
Bob
Hi Bob,
maybe I do it wrong way. I think I should check if check_id from the link is the same as uid in database and then change the verified field on true. So check_uid in database isn't necessary. But still I don't know how to change verified field in proper place.
I am new in CF so sorry for my lack of knowledge.
maybe I do it wrong way. I think I should check if check_id from the link is the same as uid in database and then change the verified field on true. So check_uid in database isn't necessary. But still I don't know how to change verified field in proper place.
I am new in CF so sorry for my lack of knowledge.
Hi Mieszko,
You can set the value of $form->data['verified'] to 'true' or 'false' if that is what you need. I'm afraid that I still don’t understand what you need to do :-(
Bob
You can set the value of $form->data['verified'] to 'true' or 'false' if that is what you need. I'm afraid that I still don’t understand what you need to do :-(
Bob
But still I don't know how to change verified field in proper place.
if you want to update an existing record then you must pass the value of the primary key of this record, so say you want to update "Verified" for record with id = 5 then you need to pass this data in a "custom code" action before the "db save" action:
if you want to update an existing record then you must pass the value of the primary key of this record, so say you want to update "Verified" for record with id = 5 then you need to pass this data in a "custom code" action before the "db save" action:
<?php
$form->data["id"] = 5;
$form->data["verified"] = 1;
This topic is locked and no more replies can be posted.