Forums

Showing DB record on thankyou page

lucasdeg 21 Apr, 2012
Using V4.

I have a form that I use to register member os an association..

After submit the form, It saves the records to a table on database.

I want in the thank you message to show the cf_id record that I just saved in the DB. This number will identify the member, like his personal code. After the submit and DB save, I want to show de cf_id just created so the person can print this form and present to me for formal subscription..

I have done everything, but I cant show the cf_id in the thank you message.

How can I do that?
GreyHead 21 Apr, 2012
Hi lucasdeg,

The cf_id is usually saved in $form->data['chronoform_data']['cf_id'] but use a Debugger action to see the exact version - it will be different if you are using a model ID for example.

Personally I don't like using sequential numbers for unique identifiers, it's too easy for one user to guess what other idenitifers are valid. I generate a random string ID instead e.g. U2384T - before the DB Save action then use that for the user identifier.

Bob
jhanikel 04 Dec, 2012
good evening everybody!

i would like to reopen this post as it seems relating to my problem. i'm using CFV4 and Joomla! 2.5.2. i have created some forms and they need to be printed after filling. Thanks to your FAQ-section about the print button i got it working but there is a problem: i would like to display cf_created and cf_user_id in the thankyou page so that users can always see on the printed version who filled the form when. After hours of surfing the forum and trying several different codings it still doesn't work. Please, can you help me somehow?
my code is:
<div id='print_div'>
<head>
<style type="text/css">
table { width:100%; }
table.padded-table td { 
	padding:5px; 
	spacing:5px;
	}
</style>
</head>
<table class="padded-table">
	<tr>
		<td colspan='2'>
			<h1>Pflegebericht</h1>
		</td>
	</tr>

	<tr>
		<td>
			Eintrag erstellt am: 
		</td>
		<td>
                <?php echo $form->data['chronoform_data']['cf_created']; ?>
                </td>
	</tr>

	<tr>
		<td>
			Name
		</td>
		<td>
			{text_patient_name}
		</td>
	</tr>
	<tr>
		<td>
			Vorname
		</td>
		<td>
			{text_patient_vorname}
		</td>
	</tr>
	<tr>
		<td>
			Verlaufsprotokoll
		</td>
		<td>
			{textarea_verlaufsprotokoll}
		</td>
	</tr>
	<tr>
		<td>
			Veränderung
		</td>
		<td>
			{dropdown_veraenderung}
		</td>
	</tr>
</table>
</div>
<input type="button" value="Print" id='print_button' style='visibility: hidden;'></input>


and the result is in the attachment :-)

i kind of have the impression that the ">" after the "<?php echo $form-" part of the php call is interpreted as the end bracket for the php call and the rest is ignored, i.e. displayed in the table as it is.

i hope i didn't do a completely stupid thing. Thank you in advance for help!

Julia
GreyHead 12 Dec, 2012
Hi Julia,

Instead of
<?php echo $form->data['chronoform_data']['cf_created']; ?>
please try {chronoform_data.cf_created}

I think that should work OK. If not, please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.

Bob
This topic is locked and no more replies can be posted.