Buy Now
Sign in

JS event on select a file and PHP processing in email template

riponinuter , May 22 2017, 16:38
R
riponinuter 5
May 22 2017, 16:38 #368481
I am currently recreating some my forms in CF v6 from v5. Having two issue:

1. In file input's settings, CFv5 used to have a field to attach a custom Javascript function that was triggered when a file was selected. How can I do the same in v6?

2. In v5 I could use php in email template. v6 seems doesn't process php tags

Thanks in advance
GreyHead 64
May 22 2017, 17:35 #368482
Hi riponinuter,

Was this the custom validation function in CFV5? I think that the equivalent must be the validation rules box - though I'm not clear how you use that.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
R
riponinuter 5
May 22 2017, 17:57 #368485
Thanks for your prompt reply.

Yes, it was in CFv5 - if you click on edit on a file input in Designer, you will see it in Validation tab (check the attachment). Not sure how to do it in validation rules box in v6. Any help would be great.

" In v5 I could use php in email template. v6 seems doesn't process php tags"
Is this by design or any other way to do that in v6?
Attachments
filevalidation.png
filevalidation.png
(67.26 KiB)
324 Downloads/Views
admin 28
May 24 2017, 10:47 #368542
Hi riponinuter,

In v6 a custom validation function can be placed in the "Validation rules" box:

validateFile:This file is not valid

And in a "Custom" javascript element use this code:

$.fn.form.settings.rules.validateFile = function(value, parameter) {
return false;
};


Regarding php, you can not call php in email body in v6, you need to use a PHP action before the email, set any value you want inside a variable:
$this->set("var_name", 333);

Then get it in email:
{var:var_name}

try to have unique var names, like "myvar" or whatever.

What are you trying to do with PHP in the email ?

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Did you try the new ChronoForms7 ? if yes then please send us your comments!!
R
riponinuter 5
May 24 2017, 16:32 #368562
Hi Max,

Thanks for all the helpful info. I think having a documentation for CFv6 would save lot of your support time.

"What are you trying to do with PHP in the email ?"

Instead of of creating many forms, for the sake of simplicity and easy maintenance, I have created a generic form that I use in many similar pages in my website. The contents of email's body depends on the page the user submit the form from. I use PHP to determine the page URL and other info, and generate contents accordingly.
admin 28
May 24 2017, 17:12 #368564
Hi riponinuter,

I will try to have some documentation added soon, thank you!

I think the best way to do it then is using the PHP function as I explained.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Did you try the new ChronoForms7 ? if yes then please send us your comments!!
R
riponinuter 5
May 24 2017, 17:24 #368567
Yes, I will use PHP before email and save dynamic email body in a variable. However, as in V5, if PHP could be processed in email body template that would have been easy and more dynamic, unless you have that in TODO list.

Thanks for all the help
admin 28
May 24 2017, 18:13 #368570
Hi riponinuter,

There is no way to process php in email body in v6, but I forgot something, you could use a "Custom code" action, it supports php, then you can enable the "return result as var", and you could just use this shortcode in the email body:

{var:custom_code_name}

The custom code output would then be placed in the email body.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!
Did you try the new ChronoForms7 ? if yes then please send us your comments!!
R
riponinuter 5
May 24 2017, 18:18 #368572
Hi Max,

Great help! will try and let you know if any issues.