Not validating, not uploading… why?
Posted: 19 November 2007 04:03 PM   [ Ignore ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Can anyone tell me why this doesn’t validate the required fields OR upload a plain text file? I’ve checked the permissions on the upload directory and that Members may upload. The user is logged-in by the time they get to this form.

I’ve even re-installed FreeForm (although the download says 2.5.7 NOT 2.5.8)

{exp:freeform:form form_name="getquote" required="comments|file1" file_upload="Main Upload Directory" return="{my_template_group}/entries_ff/%&#xen;try_id%%"}
<input type="hidden" name="email" value="{logged_in_email}" />
<
input type="hidden" name="name" value="{name}" />
<
textarea name="comments" cols="50" rows="5" /></textarea>
<
input type="file" name="file1">
<
input class="freeform" type="submit" name="submit" value="submit" />
{/exp:freeform:form}

Profile
 
 
Posted: 19 November 2007 05:18 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Well.. to answer part of my own question:

It seems that 2.5.7 (at least) will NOT validate the file input field ‘file1’. Turning on EE errors shows an error:
“Undefined index: file1 in /[my_system_path]/modules/freeform/mod.freeform.php on line 664”

Other fields seem to validate OK. Not sure what the upload problem was.. but it disappears when I avoid trying to validate the file1 field.

Profile
 
 
Posted: 20 November 2007 02:09 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

More investigation:

I thought I’d use the Entries tag to try some very clumsy validation that the user had provided a file:

{if attachment_count < 1}
{attachment_count}
<h2>Oops... there's no document attached to your request</h2>
{if:else}
{attachment_count}
<h2>Thank you for your request</h2>...
{/if}

Notice I’m counting attachments in each leg of the conditional? Well the conditional doesn’t work. I get the first leg when {attachment_count} reads ‘1’.

Why? Is FreeForm just broken? Or what?

I could really use some help here.

Thanks.

Profile
 
 
Posted: 20 November 2007 02:42 AM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Me again (!).

The reason the conditional didn’t work… it appears by experiment ... is that the FreeForm version of conditionals (or the {attachment_count} conditional, at least) is not the EE standard version. In EE the conditional would be {if attachment_count < 1} in FF it must be {if {attachment_count} < 1}.

That damned quirk has cost me at least a couple of hours. Bugger!

I’d MUCH rather have standard validation of the file input however (like the validation of other required files) using “required=“file1|emai|name”

Profile
 
 
Posted: 20 November 2007 02:13 PM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

So you got it all figured out? :D

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 22 November 2007 02:50 AM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  12
Joined  2007-11-17

Yes, thanks Pie Man. But I thought others might have the same problems. Maybe this will be addressed in future versions of FreeForm. It’s a very nice module. I’m going to donate.

Profile