Hi Mike,

Thank you for your prompt response!  Unfortunately, I'm still in a
development stage and won't be able to provide you a link to a
publicly accessible page.

However if I may, I'd like to provide some code snippets and hopefully
it might help.  First off, the code for the form is derived from a
JSP, with the form tag as follows:

<form id="dialog_form" action="refer.do" method="POST"
enctype="multipart/form-data">

The form has a number of hidden fields as well as text fields, and
finally the file input field:

<input type="file" name="dialogDatafile" size="40">

And a regular form submit button.

The Javascript code initializes the form to ajaxForm once the DOM is
loaded:

function initReferDialog() {
    $('#dialog_form').ajaxForm({
        beforeSubmit: validateReferDialog,
        success: referDialogSuccess
    });
}

My validateReferDialog method is as follows:

function validateReferDialog(formData, jqForm, options) {
    if (($('#dialogName').val() == "" || $('#dialogEmpName').val() ==
"" || $('#dialogEmpEmail').val() == "")) {
        $('#dialogMessage').empty().append("<span class='red-
bold'>Please fill in all required fields (*)</span><br/><br/>");
        return false;
    }
    return true;
}

I believe I've utilized your APIs correctly.  The one thing I've
noticed, is that when I don't include a file to be uploaded, the
request does get sent to my servlet, however the enctype is
"application x-www-form-urlencoded".  I believe in this case it gets
sent via the XMLHttpRequest object.  It's only if I include the file
that it doesn't even reach my servlet.  To test this, I simply have a
print statement as the first line of my servlet.  This statement
should always print out if the servlet is executed.

Is there anything special I have to do with the iframe?  Or is it
possible that since I'm utilizing the form within a SimpleModal dialog
box, that it's causing the issue?

Again Mike, thank you for helping me out with this.  I'm really very
new to jQuery, but I find the library the best I've ever used, and the
fact that there is a thriving community out there willing to
contribute with people such as yourself, makes it all the more better
to use.

-Dave


On May 4, 8:30 pm, "Mike Alsup" <[EMAIL PROTECTED]> wrote:
> >  I'm attempting to use the jQuery Form Plugin on a page that has
> >  multiple forms.  The particular form I am using to allow the uploading
> >  of files is the third form on the page.  I'm also using that form
> >  within a modal dialog box, using the SimpleModal jQuery plugin.  I
> >  have a Java Servlet handling the form submission.
>
> >  I am having a problem when I try to upload a file.  It looks like the
> >  request never gets to my servlet.  When I fill out the other fields of
> >  the form out, leaving the upload blank, it's working fine.  However,
> >  once I attempt to include a file to upload, the servlet never gets
> >  invoked.
>
> >  I understand that the XMLHttpRequest cannot send files over, but that
> >  the Forms Plugin utilizes an iFrame to do so.  However, it's not
> >  working in my case.  I've read a blog in which the person is able to
> >  address this, found here:  
> > http://www.ender.com/2008/04/jquery-the-jquery-form-plugin.html.
> >  I tried his suggestions of including a hidden field in my form, but
> >  it's still not reaching my servlet.
>
> >  Could the problem actually be the fact that I have more than one form
> >  on the page?  Any help would be greatly appreciated.  Thanks.
>
> The Form Plugin fully supports multiple forms on a page so that
> shouldn't be causing your problem.  Can you post a link to your page?

Reply via email to