I am trying to submit a form inside another form because I will need first form s outcome in the second form. I tried using form serialize as advised in some other threads. Problem here is, I dont receive an error but it does not function either.
<script type="text/javascript">
$(document).ready(function(){
$("[id= video-submit ]").click(function() {
$.ajax({
type: "POST",
data: $("#VideoForm").serialize(),
url: "cp.asp?Process=UploadVideo",
success: function(output) {
$("#output").html(output);
},
error: function(output) {
$("#output").html(output);
}
}); //close $.ajax(
});
});
</script>
<div id="form">
<form method="post" action="?Section=controlpanel&Process=AddVideo">
<fieldset>
<div class="required" id="VideoForm">
<label for="VideoURL">Video File</label>
<input type="file" size="23" name="VideoFile">
<input type="button" name="Submit" id="video-submit" value="Upload" />
</div>
<div id="output">
</div>
</fieldset>
<fieldset>
<div class="required">
<label for="VideoName">Video Name</label>
<input type="text" name="VideoName" id="form-text<%=VideoNAME_ERR%>" />
</div>
<div class="required">
<label for="VideoDuration">Video Duration</label>
<input type="text" name="VideoDuration" id="form-text<%=VIDEODURATION_ERR%>"/>
</div>
<div class="required">
<label for="VideoShortDesc">Video Short Desc</label>
<textarea rows="5" cols="30" name="VideoShortDesc" id="form-text<%=VideoSHORTDESC_ERR%>" ></textarea>
</div>
<div class="required">
<label for="Publish?">Publish?</label>
<select size="1" name="Active" id="form-text">
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
</fieldset>
<fieldset>
<input type="submit" name="Submit" id="form-submit" value="Submit" />
</fieldset>
</form>
</div>
cp.asp?Process=UploadVideo :::
Case "UploadVideo"
Path = "/media/videos"
Set Upload = Server.CreateObject("Persits.Upload" )
Upload.IgnoreNoPost = True
Upload.OverwriteFiles = False
Upload.SetMaxSize 104850 Truncate files above 10MB
Upload.SaveVirtual(Path)
For Each File in Upload.Files
If File.ImageType = "UNKNOWN" Then
Response.Write "You cannot upload an unknown format."
File.Delete
Response.End
Else
Response.Write "Video successfully attached!"
Response.Write "<input type=""hidden"" name=""VideoURL"" value=""/media/videos/" & Server.HTMLEncode(File.OriginalPath) &""" />"
End If
Next