Forums

How to access field values in events

mankind1023 06 Nov, 2011
Hi, I'm writing some custom events but I don't know how to access the values that were in the form, is there a way to do that directly without querying the database?

Example: user uploads an image, in the "Upload Files > On Success" I want to display the name of the new name of file (the one chronoforms just renamed it to with all the numbers at the front).
GreyHead 07 Nov, 2011
Hi mankind1023,

From the Uplaod Files Help tab:

Files data will be stored after processing under the $form->files AND $form->data['_PLUGINS_']['upload_files'].
You can add a "Custom code" action after this one and use this code to check/user the response data stored : print_r2($form->data['_PLUGINS_']['upload_files']);



If you use my custom action [url=http://greyhead.net/how-to-docs/chronoforms-v4-actions]Upload Files [GH[/url] ] there are a few more variables stored:

The file data will be made available in a series of form data values: the file name in {input_name}; the file size in {input_name_size}; the file size in {input_name_url}; and the file url in {input_name_url}. In each case replace input_name with the name of the input in your form e.g. {input_file_0_path}
File data will also be saved in the $form->files and $form->data['_PLUGINS_']['upload_files'] arrays. You can add a "Custom code" action after this one and use this code to check the response data stored: print_r($form->data['_PLUGINS_']['upload_files']);



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

VPS & Email Hosting 20% discount

{item:title} {images:#}