Results 1 to 5 of 5

Thread: Form only works when file uploads have been selected

  1. #1
    Join Date
    Nov 2009
    Posts
    10

    Default Form only works when file uploads have been selected

    I've got my form working perfectly with file upoads, renaming the files etc. The problem is that it only works as long as file uploads option is used. I have four file upload fields. I need the user to be able to use the form with the option to upload either no files at all or any number of files up the four maximum. At the moment, the form only works when using all four file upload options. I have no 'required' hidden field. The hidden fields I am using are:
    good_url
    bad_url
    conditions1
    conditions2
    conditions3
    conditions4
    MAX_FILE_SIZE
    file_names

  2. #2
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: Form only works when file uploads have been selected

    so 4 or none, is that right?

    then ur conditions must be wrong.

    post them and we can take a look.

  3. #3
    Join Date
    Nov 2009
    Posts
    10

    Default Re: Form only works when file uploads have been selected

    Yeh, it's four file uploads selected, or the form doesn't work at all.

    Here are the conditions:

    <input name="conditions1" type="hidden" id="conditions1" value=":@
    @TEST@first_file~/^.*\.(pdf|jpg|jpeg|gif|png)$/i@You can only upload PDF or graphics files@" />
    <input name="conditions2" type="hidden" id="conditions2" value=":@
    @TEST@second_file~/^.*\.(pdf|jpg|jpeg|gif|png)$/i@You can only upload PDF or graphics files@" />
    <input name="conditions3" type="hidden" id="conditions3" value=":@
    @TEST@third_file~/^.*\.(pdf|jpg|jpeg|gif|png)$/i@You can only upload PDF or graphics files@" />
    <input name="conditions4" type="hidden" id="conditions4" value=":@
    @TEST@fourth_file~/^.*\.(pdf|jpg|jpeg|gif|png)$/i@You can only upload PDF or graphics files@" />
    <input name="MAX_FILE_SIZE" type="hidden" id="MAX_FILE_SIZE" value="60000" />
    <input name="file_names" type="hidden" id="file_names" value="first_file=Name.%'-file1'%.%2E%.%ext(first_file)%, second_file=Name.%'-file2'%.%2E%.%ext(second_file)%, third_file=Name.%'-file2'%.%2E%.%ext(third_file)%, fourth_file=Name.%'-file2'%.%2E%.%ext(forth_file)%" />

  4. #4
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: Form only works when file uploads have been selected

    ok, so ur conditions basically say that "first_file" must have a particular pattern, AND "second_file" must have a particular pattern, and so on.

    so, if one of them doesn't, then error...

    the way to fix this is with the IF feature in conditions.

    e.g.

    HTML Code:
    <input name="conditions1" type="hidden" id="conditions1" value=":@ 
              @IF@first_file@first_file~/^.*\.(pdf|jpg|jpeg|gif|png)$/i@@You can only upload PDF or graphics files@" />
    which says: if first_file has been filled in (has a value), then it must match the pattern, otherwise OK. if has been filled in and doesn't match the pattern, display error.

  5. #5
    Join Date
    Nov 2009
    Posts
    10

    Default Re: Form only works when file uploads have been selected

    Spot on! That works a treat! Thanx for all your help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Script Works, Email Contains No Information
    By JakeForest in forum FormMail Subscription Support
    Replies: 10
    Last Post: 28-Dec-2005, 10:51 PM
  2. File uploads
    By dRiver in forum FormMail Subscription Support
    Replies: 2
    Last Post: 15-Jun-2004, 05:14 AM
  3. Directing Form to File - Need Help
    By rongreen in forum FormMail Subscription Support
    Replies: 13
    Last Post: 02-Mar-2004, 03:53 AM
  4. Help trying to set up a form to email and send info to file
    By rridsdale in forum FormMail Subscription Support
    Replies: 1
    Last Post: 14-Jan-2004, 02:38 AM
  5. Formmail works fine, but no e-mail
    By Wiggy in forum FormMail Subscription Support
    Replies: 1
    Last Post: 08-Jan-2004, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •