두 번째 양식에서 첫 번째 양식의 결과가 필요하므로 다른 양식 내부에서 양식을 제출하려고합니다. 양식을 사용하여 다른 스레드에서 권고대로 serialize 해 보았습니다. 문제는 여기서 오류가 발생하지 않지만 작동하지 않습니다.양식 내부 양식 문제가 발생했습니다
<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? 프로세스 = 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
중첩 된 양식이 지원되지 않습니다. 구문 상 유효하지 않으며 모든 HTML 유효성 검사기가이를 받아들입니다. –
@ Cballou :은 실제 HTML 중첩 된 형식이 아닙니다. 그 폼이 AJAX – AnthonyWJones
을 사용하여 게시 된 필드를 포함하는 진한 DIV 일 때 "폼"을 중첩 할 수 있습니다. 보안상의 이유로 JS를 통해 파일 입력 값을 가져올 수 있다고 생각하지 않습니다. 설정하거나 변경할 수 없습니다. –