XUpload - Passing form fields into custom confirmation email...

Message
Author
jugganaut
Posts: 9
Joined: Mar 12, 2008 4:01 pm

Passing form fields into custom confirmation email...

#1 Postby jugganaut » Mar 12, 2008 4:12 pm

I'm creating custom email notifications and I'm a little confused as to how the variables are passed, using <TMPL_LOOP> or <TMPL_VAR NAME="PARAMETER_NAME"> or <input name=param type=text value="<TMPL_VAR NAME="PARAM">">...

I just want to stick in the filename in one spot within an html emal.

Also, the bigger question, can I pass field info from the upload form that I've created into the email? For instance, I've added a "description" field into the form, can I pass just this field into the email without doing the whole Upload Parameters block?

Thanks!

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Mar 13, 2008 7:35 am

what xupload version?

jugganaut
Posts: 9
Joined: Mar 12, 2008 4:01 pm

#3 Postby jugganaut » Mar 13, 2008 3:48 pm

the latest

jugganaut
Posts: 9
Joined: Mar 12, 2008 4:01 pm

#4 Postby jugganaut » Mar 13, 2008 3:51 pm

I received this email from sibsoft, but it doesn't address placing individual form field information in the confirmation email. For instance, in the customer email, I don't want to pass all of the fields in my custom upload form. BUT, maybe I just want to place the field "name". How can I pull the individual fields to put them in the template?
In upload.cgi need after string:

$tmpl->param('files' => \@files,

Need to add:

'params' => \@har,



This is an array of parameters passed in addition. In order to print all of
params passed you should add following code in template:


<TMPL_LOOP params>
<TR<TMPL_IF style> class="style<TMPL_VAR style>"</TMPL_IF>><TD width="1%"
nowrap><TMPL_VAR name>:</TD><TD><TMPL_IF value2><TMPL_VAR
value2><TMPL_ELSE><TMPL_VAR value></TMPL_IF></TD></TR>
</TMPL_LOOP>

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#5 Postby PilgrimX182 » Mar 14, 2008 7:55 am

in upload.cgi
above $tmpl->param(.... add

Code: Select all

$tmpl->param($_->{name} => $_->{value}) for @har;
now you can add tags like <TMPL_VAR description> into email template,they will be replaced with your custom fields values.

jugganaut
Posts: 9
Joined: Mar 12, 2008 4:01 pm

#6 Postby jugganaut » Mar 17, 2008 4:01 pm

ok great! that worked out beautifully. I have one more question. I'd like to make some of the fields in the form required - javascript? I've tried a couple of different things, but because the "file" field has a required script, this may cause some problems?

Thanks

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#7 Postby PilgrimX182 » Mar 18, 2008 7:14 am

In xupload.js find

Code: Select all

if(NF==0){alert('Select at least one file to upload');return false;};
and add below something like this:

Code: Select all

if(f1.myfield && f1.myfield.value==''){alert("myfield required");return false;}
where myfield is name of your custum field.
You can add multiple lines like this.

jugganaut
Posts: 9
Joined: Mar 12, 2008 4:01 pm

#8 Postby jugganaut » Mar 19, 2008 1:48 pm

hmmm... that doesn't seem to do anything...

jugganaut
Posts: 9
Joined: Mar 12, 2008 4:01 pm

#9 Postby jugganaut » Mar 19, 2008 1:53 pm

I take that back, it does show the javascript, but it only gives one warning. I have four fields: Name, Email, Phone, Sales Rep. Whether you have Sales Rep filled in or not, it gives the Sales Rep warning if any of the others are empty... Is there a way to list them all together?