.append($(":input",form).clone())
This line does add all the input fields inside the "form" element
(which actually isn't a <form>) to the generated one.
The thing is, that I have a table and need a <form> for every row (but
not in a single column). <form><tr> or <tr><form> aren't valid.
So I'm looking for all input fields inside the <tr> and generate a new
one...
On Dec 19, 5:09 pm, brian <[email protected]> wrote:
> Why don't you simply submit the form you are cloning from? It doesn't
> appear to me that you're adding anything to the new form.
>
>
>
> On Sat, Dec 19, 2009 at 10:57 AM, oli <[email protected]> wrote:
> > Hi,
>
> > I want to collect some input fields that are already present in my
> > DOM, generate a form with jQuery and submit it. Everything works fine,
> > unless if one of those input fields is a type="file" field.
>
> > $(".trform .sendform").click(function(e) {
> > e.preventDefault();
> > var form = $(this).closest(".trform");
>
> > var method = form.find(":input[name=method]").val();
> > var action = form.find(":input[name=action]").val();
> > var enctype = form.find(":input[name=enctype]").val();
>
> > $(document.createElement('form'))
> > .attr("method",method)
> > .attr("action",action)
> > .attr("enctype",enctype);
> > .append($(":input",form).clone())
> > .submit();
> > });
>
> > If there is a file upload field, it's value after the submit is empty.
>
> > Any suggestions what I could do?
>
> > Regards, Jan Oliver