get cf_id after submission CF V4

ma marklandry 19 Oct, 2011
Hi,
I'm trying to post cf_id to a db table on form submission in V4. I've seen posts for this regarding V3 but can't seem to get it to work in 4.

This is what I've got:
in "custom code-after emails" (in controller mode):


<?php
$cf_id = $MyForm->tablerow["jos_chronoforms_rak_submit_copy"]->cf_id; 
rename("image_upload/upload_pic/marklandry.jpg", "image_upload/upload_pic/marklandry".$cf_id.".jpg");
?>
Gr GreyHead 21 Oct, 2011
Hi Mark,

Please add a debug echo statement to make sure that you are getting the value of cf_id; and make the paths absolute rather than relative. Relative paths are too uncertain in Joomla! as you are never quite sure what the current path is.
<?php
$cf_id = $MyForm->tablerow["jos_chronoforms_rak_submit_copy"]->cf_id;
//debug code
$mainframe =& JFactory::getApplication();
$mainframe->enqueuemessage('$cf_id: '.print_r($cf_id, true).'<hr />');
// end debug code
rename(JPATH_SITE.DS.'image_upload'.DS.'upload_pic'.DS.'marklandry.jpg', 
  JPATH_SITE.DS.'image_upload'.DS.'upload_pic'.DS.'marklandry{$cf_id}.jpg');
?>

Bob
ma marklandry 24 Oct, 2011
Hey Bob,
Thanx for your help.
Made the changes above (thanx also re paths🙂 )
the file is changed to "marklandry{$cf_id}.jpg"
and the debug info says something like "cf_id: "
Gr GreyHead 24 Oct, 2011
Hi Mark,

I'm getting my versions mixed up :-(

In CFv4 the saved data is in $form->data[$model_id] and your model ID is probably the default 'chronoform_data' so please try
$cf_id = $form->data['chronoform_data']->cf_id;
or possibly
$cf_id = $form->data['chronoform_data']['cf_id'];


Bob
ma marklandry 25 Oct, 2011
bummer, still the same results as before - ie, debug alert is empty and filename is appended to "marklandry{$cf_id}.jpg".
The model id number is the default...
Not sure what else could be wrong
Gr GreyHead 04 Nov, 2011
Hi Marc,

Does the system message from the debug line show that $cf_id has a value?

Bob
ma marklandry 04 Nov, 2011
No, it just says something like "cf_id: "
This topic is locked and no more replies can be posted.