i have a form in another form............

<form1>

<form2>
</for>

</form>

the form2 is submited automatically, and has only one field of fileupload, and is auto processing file upload with jquery ajax...!!

it works fine for me but when i pass the response filename of form2 to form1 <input> field it shows me fine........but when i submit form1 the <input> field which contains the form2 response value it says empty........!! how can i fix that

Recommended Answers

All 4 Replies

Hey.

You should not stack forms like that. It is considered invalid HTML, so you can't really rely on browsers treating them consistently.

Both IE7 and Firefox, for instance, flat out refuses to submit the outer-form, and if forced to do so by JavaScript, exclude the <input> elements belonging solely to the outer form.

I recommend that you move the inner form out of the outer form, and find a way to make it work that way.

but beside this problem it is working all the way fine..........
well, let me know how to change the default value of input field on form submit with jquery
e.g
<input type="text" value="" name="name">
and change it to
<input type="text" value="mydynamicvalue" name="name">

Ok, that's fairly simple using jQuery.

For example, if you wanted to copy the value of one <input> to another before submitting, you could do:

<!DOCTYPE html>
<html>
<head>
    <title>Tesst</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript">
        function form1_onsubmit()
        {
            $("#form1_field2").attr('value', $("#form1_field1").attr('value'));
            return true;
        }
    </script>
</head>
<body>
    <form name="Form1" action="?" method="post" onsubmit="form1_onsubmit();">
        <input type="text" name="field1" id="form1_field1" />
        <input type="text" name="field2" id="form1_field2" /><br />
        <input type="submit" />
    </form>
</body>
</html>

Note, you can not change the value of "file" input boxes. This is a security measure.

thanks boss................it works for me.............!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.