Thanks for the reply, Jack.

 

Got it all worked out!  :o)

 

Rick

 

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jack 
Killpatrick
Sent: Friday, March 28, 2008 1:04 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Calling all jQ & CF users...

 

I know this post is old, but anyway... I haven't looked that carefully, but 
perhaps the issue has to
do with cloning an input that has an ID, thus ending up with 2 controls with 
the same id (albeit
different names)?

I'm not sure why image-upload-2 would not exist on submit even if you didn't 
click the link to
create it, since it looks like it's hardcoded in the html (the 
name="image-upload-2")?

- Jack

Rick Faircloth wrote: 

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>  

 

Reply via email to