Well... the results are mixed.  I posted this over on the jQuery list, too,
in case it was more of a jQuery problem than CF.

But I've copied the post below, if you have time to look at it.

Thanks for your help!

Rick


Hi, all.

Well, I'm still on the path of trying to create a file input cloning system,
with CF as the server-side processor.

I'm having mixed results.

FF2 just returns to the page with no uploads or errors.

IE7 uploads a file for the first filefield, but, even when there is no
second field that has been added via JS, I get an error stating that
"The form field 'IMAGE-UPLOAD-2' did not contain a file."

Well, form field 'IMAGE-UPLOAD-2' wouldn't contain a file, because I hadn't
click on the link connected to the JS that would have created a form field
called 'IMAGE-UPLOAD-2'. IE seems to think that form field exists, when it 
doesn't.

I've included my jQuery below and the CF and HTML.
If anyone could take a look and see if you spot a problem, please do.

If it will help, I'll re-create this page online.

Thanks for any help!

Rick

jQuery:

$(document).ready(function() {
        $('#add-image').click(function() {
                $('#image-next').clone(true).
                attr('name', function() {
                        return this.name.replace(/(.+)(\d+$)/, function(s, p1, 
p2) {
                                return p1 + (parseInt(p2, 10) + 1);
                        })
                })
                .insertAfter('#image-div :last');
        });
});


CF for processing form when submitted:

<cfif isDefined("form.fieldnames")>
                
        <cfloop collection="#form#" item="fieldname">
                <cfoutput>
                #fieldname# - #form[fieldname]#<br>
                </cfoutput>
                        
                <cfif left("#fieldname#", 5) eq "image">
                                
                        <cffile action="upload" filefield="#fieldname#"
destination="e:\inetpub\webroot\test"
                                  accept="image/jpg, image/pjpg, image/jpeg, 
image/pjpeg"
nameconflict="makeunique">
                                
                </cfif> 
                                
        </cfloop>
                                        
</cfif>


Relevant HTML:

<ul>
        <li>Click the browse button to locate an image.</li>
           <li>Use the "Add New Image Field" button below to create addition 
image input
fields.</li>
</ul>
        
<div style="margin-left:60px;">
        
        <form name="add-image-form" action="#cgi.script_name#" method="post"
enctype="multipart/form-data">
        
        <div id="image-input">
                <div id="image-div">
                <input style="margin-bottom:25px; display:block;" 
id="image-next"
name="image-upload-2" type="file" size="60" value="">
                </div>
        </div>

                <p><a id="add-image" href="#">Add New Image Field</p>
                
                <input name="submit" type="submit" value="Submit Form">
                
        </form>
                
</div>



> -----Original Message-----
> From: Rick Faircloth [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 21, 2008 8:54 AM
> To: CF-Talk
> Subject: RE: Brain not working... how do I get these values?
> 
> Sounds like a good idea, Matt.
> 
> I'll give that a try!
> 
> Thanks!
> 
> Rick
> 
> > -----Original Message-----
> > From: Matt Williams [mailto:[EMAIL PROTECTED]
> > Sent: Friday, March 21, 2008 7:49 AM
> > To: CF-Talk
> > Subject: Re: Brain not working... how do I get these values?
> >
> > On Thu, Mar 20, 2008 at 11:13 PM, Rick Faircloth
> > <[EMAIL PROTECTED]> wrote:
> > >  I'll get on the jQuery list, which is the library I'm using
> > >  to perform the form field additions and find out how to implement
> > >  the counter.
> >
> > Rick,
> >
> > You don't really need a counter. Just do something like (not checking
> > syntax here...):
> > <cfloop collection="#form#" item="FieldName">
> >   <cfif Left(FieldName,5) EQ "file_">
> >     <cffile action="upload" fileField="#FieldName#" destination="..."
> > [otherattributes] />
> >   </cfif>
> > </cfloop>
> >
> > --
> > Matt Williams
> > "It's the question that drives us."
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301756
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to