Buy Now
Sign in

Unique Code - form of complaints

tigsphn , December 02 2013
T
tigsphn
Dear

good afternoon

I am creating a form of complaints and I have a problem

The form must have a unique code so I created a script for it using the " Custom Element " , but I need the value it returns me to be placed on a table .

I noticed that when trying to create a new table appear the existing fields in the form minus the " Custom Element " .

The same situation occurs when the email is sent to the administrator , for, as the code is based on the date , minute, and second , when you click submit , the script runs again and the code that arrives to the administrator is different from that presented in screen before submitting the form .

Below is the code :
< ? php
     / / Echo uniqid ( ) , '<br />' ;
     $ year = substr ( date (' Y' ) , 3,1 ) ;
     $ month = substr ( date (' m ' ) , 1,1) ;
     $ day = date (' d ' ) ;
     $ hour = substr ( date (' H ' ) , 1,1) ;
     $ min = substr ( date (' i ' ) , 1,1) ;
     $ sec = date (' s' ) ;
    
    echo " <p> <centre> color='#ffffff'> _ < / font > < / p > " ;
    echo $ year $ month $ day $ hour $ min $ sec . ;
>


I do not know if I explained well .
What I really need is that my form submit a unique code and that for each user , a new code is generated .

This same code needs to be entered in the table and be properly sent to the administrator .

In await .
Grateful.
T
tigsphn
Anybody?

Please!!!!
GreyHead
Hi tigshpn,

Please see this FAQ

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
tigsphn
Thank's again

I read de FAQ but I still confuse about somethings,

Let's try do diferent:

The cf_id is a unique data?
Maybe can be a good idea show de cf_id to client in Thanks Message.

Example:
"Your form was submitted successfully, please write down your serial protocol (cf_id)"

Is it possible?

If Yes, How can I send this information to admin email too?

The site with form: http://www.portalsupimpa.com.br/site/new/index.php/ouvidoria

Thank's again
GreyHead
Hi tigsphn,

The cf_id is the record identifier in the database 1, 2, 3, . . . it does uniquely identify the record saved. But it's not always a good idea to use it to share with users as it is easy to use it to guess what other ids are valid and that might be a security risk.

Yes it is possible to show the cf_id in a Thank You message; I think that the FAQ tells you now to get the value.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
tigsphn
Hello GreyHead

I tried to use the Unique ID (GH) but had no success.

I noticed that there are 4 fields, my question is regarding the Table column, I tried to do the following:

I created a new table and she, by default now shows which fields will be written on it, right?

So I includes a new field called id_new_column (Figure print01).

I then changed the configuration of the DB Save and put the Unique ID (GH) on the submit area (Figure print02)

In the Settings area of the Unique ID (GH) in the field put id_new_column Table column as well as in Form Input Field (print03 figure)

I did a couple of tests with the form and then I analyze the database id_new_column but the field was empty.

Where am I going wrong? These steps are correct?
Attachments
print01.jpg
print01.jpg
(49.94 KiB)
862 Downloads/Views
print02.jpg
print02.jpg
(27.73 KiB)
870 Downloads/Views
print03.jpg
print03.jpg
(40.93 KiB)
865 Downloads/Views
S
scree23
I have a similiar problem, that I cant get it how it works:) Is there any documenatation how to use this unique ID.

Actually I need this Unique ID to show in the form, so I cant put this action ON SUBMIT, but I need it ON LOAD. Than I need some visible input field, which will show this number anf after submitting the form I need to be saved in a DB and at the same time I need it to be send as MerchantOrderId to payment gateaway.

Could you please explain me how to do it ?


thanks, I´am hopeless
GreyHead
Hi,

@tigsphn: Well, you need to create the Unique ID before you try to save it to the Database table so the order of your actions needs to change. In order to check that the ID is unique it has to be saved in a table - typically as part of the same record as the other form data.

@scree23: If you have the Unique ID [GH] action installed please check the help tab; there is much more information there.

You can create a unique ID and show it in the form but it is much more complicated to do and probably isn't helpful. There will be many times that the form page is loaded but the form is not submitted; you will need to keep track of these 'wasted' IDs somehow and do some house-keeping to let them expire. It is much better to generate the ID after the form is submitted, then you can show it to the user in an email and/or the Thank you page.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
tigsphn
How can I create the Unique ID before inserting it into the database if the settings for the Unique ID it asks all the database, including the name of the table column?

It makes sense to have at least one record written to be able to do the validation, that is, in fact, it would be necessary to create the Unique ID before but do not understand how this process is done

Please, could be a step by step or just an exemplification of this part?
GreyHead
Hi tigsphn,

. . . because in order to make sure that it is unique the action checks to make sure that it hasn't already been used. It does that by generating an id, then checking if it has been used. If it has, then it generates another id and tests again.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
T
tigsphn
Okay, I get the concept.

But practically what that means?

Should I put the Unique ID without any configuration to the database and only after the form is submitted the first time, should I create a field in the database to connect the Unique ID?

The problem is that I am unable to see what practical to be done that I need procedure.

I explained some topics above step by step what I did and put up the images, so you mentioned that we need to generate the Unique ID before connecting to the database, but how do I do that?
GreyHead
Hi tigsphn,

Please stop and think this through. You have the Unique ID [GH] action, that will generate a unique ID for you after the form is submitted and before the data is saved to the database. Of course you need a column in the database table to save the ID.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
scree23
Hi Bob, ok I get it it make a sense now.

In general, maybe I have a different problem. I need that user and form data are redirected to the payement gateaway jus after form submitting. For that case I need an unique number which could be an cf_id number from column in database.

I am using function ReDirect URL and ReDirect user and I really need that number from database is send to that gateaway.

Could you please tell me how to use that value of column and send it by function ReDirect URL?


There is more explanation:
http://resize.like.cz/images/213_168_186_238_11-12-13-11-40-56_13867584561.jpg
http://resize.like.cz/images/213_168_186_238_11-12-13-11-41-08_13867584682.jpg

thank you
GreyHead
Hi scree23,

Please check the FAQ I linked to in this earlier post here.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
scree23
Thanks for information, I already checked this FAQ to see all the possibilities I have.

Into ReDirect URL I add a line for MerchantOrderId, which is send to the payment gateaway. Now I have this :

MerchantOrderId={$form->data['chronoform_data']['cf_id']}

But still have no success to see this number, when it redirect to gateaway, I can´t see MerchantOrderId value.

When I want to use this column cf_id in thanks message, or in e-mail. How I can define it?
GreyHead
Hi Scree23,

Please try MerchantOrderId={chronoform_data.cf_id}

And put {chronoform_data.cf_id} in the email

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
scree23
Hi Bob,

I have tried it but I still can´t see that number on payment gateaway. I can see Amount value there, I can see MicroAccountNumber (which is fixed) but I can´t load this important value from database CF_ID.


Just one idea I have, my table´s name is: ew23_chronoforms_data_nova_sim_cz_paysec

Could I use: {ew23_chronoforms_data_nova_sim_cz_paysec.cf_id} ??? Or something similiar, cause I have more tables in Chronoforms and every table using cf_id.

Do you have any other idea ? I´m sure I have function Save to database before function ReDirect URL.


thank you for reply
GreyHead
Hi scree23,

You can try that but I don't expect it to work; the more useful approach is to add a Debugger action to see exactly where the value you need it saved.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
scree23
Finally I have it, thank you Bob. This debugger helps me a lot to find a real name of this database field. Sending you a printscreen, if someone needs to use CF_ID as unique number for online payments here we go.
Attachments
GreyHead
Hi scree23,

I think that Sloan's answer is to an earlier post in the thread.

In general I advise against using the cf_id as an identifier - but it does depend on the application and may be fine. The potential problem is that if 98 is valid then probably 97 and 99 are as well and if they are used in any url, like a download link a malicious user could guess other valid urls and use them.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much