Forums

Filename customize

upazupa 21 Oct, 2011
Hello,

I've a form with an upload field.
I've installed an upgrade where I can edit the filename:
http://greyhead.net/how-to-docs/cfv4-upload-files-gh-action

(about this update, there is in top of the file upload_files_gh.ctp, from line 5 to 7 is commented, which means "On Success" function is not working, so you have to uncomment it)

I test the filename part and is working, so right now I have:
{input_hidden_6}_{input_radio_0}


{input_hidden_6} = {username}
{input_radio_0} = it depends of the value that user chooses.

My goal is to have also a specific column value from a table, and also the datetime.
How can I do this?
GreyHead 21 Oct, 2011
Hi upazupa,

Just curious - why do you need the On Success event? I left it out deliberately.

For the table column and the date, use a Custom Code action before the Email action to get/set the values and put them into the $form->data array. For example:
<?php
$db =& JFactory::getDBO();
$query = "
    SELECT `name`
        FROM `#__some_table`
        WHERE `id` = '{$form->data['id']}' ;
";
$db->setQuery($query);
$form->data['some_name'] = $db->loadResult();
$form->data['some_date'] = date('m/d/Y');
?>


Bob
upazupa 24 Oct, 2011
Hello,

After all I don't need the "On Success", I though I would need according to other actions like "Check Captcha".
And the code works perfectly!

Once again, many thanks for your great support GreyHead!🙂
This topic is locked and no more replies can be posted.