我正在使用垂直布局来显示一个包含 12 个步骤的表单。当我点击完成时,仅提交第一部分。
这是javascript代码:
$('#wizard').smartWizard({
selected:0,
enableAllSteps: true, // Enable/Disable all steps on first load
transitionEffect: 'fade', // Effect on navigation, none/fade/slide/slideleft
contentCache:true, // cache step contents, if false content is fetched always from ajax url
cycleSteps: true, // cycle step navigation
enableFinishButton: true, // makes finish button enabled always
onFinish: onFinishCallback,
onCancel: onCancelCallback,
errorSteps:[], // array of step numbers to highlighting as error steps
labelFinish:'Finish', // label for Finish button
labelCancel:'Cancel'
})
function onFinishCallback(){
/*$("#classEditForm").submit();*/
$.ajax({
type:'POST',
url: 'index.cfm?action=addClassData&nolayout',
data: $('#classEditForm').serialize(),
cache: false,
success: function(){
alert("successful post");
/*$("#editPage").jqmHide();*/
},
error: function(){
}
});
}
function onCancelCallback(){
$("#editPage").jqmHide();
};
和 HTML/CF 代码:
<cfoutput query="variables.classData">
<table id="classInfo">
<tr>
<th>Course Number</th>
<th>Course Name</th>
<th></th>
</tr>
<tr>
<td valign="middle" id="cNum" class="classData">#CRS_COURSE_NUMBER#</td>
<td>#CRS_COURSE_DESCRIPTION#</td>
<td align="right"></td>
</tr>
</table>
</cfoutput>
<div id="wizard" class="swMain">
<ul>
<li>Administrative Data</li>
<li>About the Program</li>
<li>Activities</li>
<li>Concepts</li>
<li>Lab Requirements</li>
<li>Notes</li>
<li>Objectives</li>
<li>Philosophy</li>
<li>Preparation</li>
<li>Software</li>
<li>Techniques</li>
<li>File Uploads</li>
</ul>
<cfoutput query="variables.classData">
<div id="step-1">
<form id="classEditForm" action="index.cfm? action=addClassData&nolayout" method="post">
<input type="hidden" name="COURSE_NUMBER" id="course_number" value="#CRS_COURSE_NUMBER#"/>
<fieldset>
<legend class="StepTitle">Administrative Data</legend>
<label for="POC" id="poc_label" style="margin-right: 38px;">Point of Contact</label>
<input type="text" id="POC" name="POC" value="#POC_TITLE#" class="txtBox" style="margin-bottom: 3px;">
<label for="POE" id="poe_label">Point of Contact Email</label>
<input type="text" id="POE" name="POE" value="#POC_EMAIL#" class="txtBox">
<div>
<label>AFNorth Only: </label>
<div id="AFNorth">
<cfswitch expression="#AFNORTH#">
<cfcase value="1">
<label for="AFNorth_Yes" class="rbLabel">Yes</label>
<input type="radio" id="AFNorth_Yes" name="AFNorth" checked="checked" value="1">
<label for="AFNorth_No" class="rbLabel">No</label>
<input type="radio" id="AFNorth_No" name="AFNorth" value="0">
</cfcase>
<cfcase value="0">
<label for="AFNorth_Yes" class="rbLabel">Yes</label>
<input type="radio" id="AFNorth_Yes" name="AFNorth" value="1">
<label for="AFNorth_No" class="rbLabel">No</label>
<input type="radio" id="AFNorth_No" name="AFNorth" checked="checked" value="0">
</cfcase>
<cfdefaultcase>
<label for="AFNorth_Yes" class="rbLabel">Yes</label>
<input type="radio" id="AFNorth_Yes" name="AFNorth" value="1">
<label for="AFNorth_No" class="rbLabel">No</label>
<input type="radio" id="AFNorth_No" name="AFNorth" checked="checked" value="0">
</cfdefaultcase>
</cfswitch>
</div>
</div>
<div>
<label>International Baccalaureate</label>
<div class="intlBac">
<cfswitch expression="#IB_COURSE#">
<cfcase value="1">
<label for="IB_Yes" class="rbLabel">Yes</label>
<input type="radio" id="IB_Yes" name="IB_Course" checked="checked" value="1">
<label for="IB_No" class="rbLabel">No</label>
<input type="radio" id="IB_No" name="IB_Course" value="0">
</cfcase>
<cfcase value="0">
<label for="IB_Yes" class="rbLabel">Yes</label>
<input type="radio" id="IB_Yes" name="IB_Course" value="1">
<label for="IB_No" class="rbLabel">No</label>
<input type="radio" id="IB_No" name="IB_Course" checked="checked" value="0">
</cfcase>
<cfdefaultcase>
<label for="IB_Yes" class="rbLabel">Yes</label>
<input type="radio" id="IB_Yes" name="IB_Course" value="1">
<label for="IB_No" class="rbLabel">No</label>
<input type="radio" id="IB_No" name="IB_Course" checked="checked" value="0">
</cfdefaultcase>
</cfswitch>
</div>
</div>
</fieldset>
</div>
<div id="step-2">
<fieldset>
<div id="about">
<label for="abt" class="topLabel StepTitle">About the Program</label>
<textarea id="abt" name="abt" class="classEditText">#ABOUT_PROGRAM#</textarea>
</div>
</fieldset>
</div>
<div id="step-3">
<fieldset>
<div id="activities">
<label for="act" class="topLabel StepTitle">Activities</label>
<textarea id="act" name="act" class="classEditText">#ACTIVITIES#</textarea>
</div>
</fieldset>
</div>
<div id="step-4">
<fieldset>
<div id="concepts">
<label for="con" class="topLabel StepTitle">Concepts</label>
<textarea id="con" name="con" class="classEditText">#CONCEPTS#</textarea>
</div>
</fieldset>
</div>
<div id="step-5">
<fieldset>
<div id="labs">
<label for="lab" class="topLabel StepTitle">Lab Requirements</label>
<textarea id="lab" name="lab" class="classEditText">#LAB_REQ#</textarea>
</div>
<div id="step-6">
<fieldset>
<div id="notes">
<label for="nts" class="topLabel StepTitle">Notes</label>
<textarea id="nts" name="nts" class="classEditText">#NOTES#</textarea>
</div>
</fieldset>
</div>
<div id="step-7">
<fieldset>
<div id="objectives">
<label for="obj" class="topLabel StepTitle">Objectives</label>
<textarea id="obj" name="obj" class="classEditText">#OBJECTIVES#</textarea>
</div>
</fieldset>
</div>
<div id="step-8">
<fieldset>
<div id="philosophy">
<label for="phi" class="topLabel StepTitle">Philosphy</label>
<textarea id="phi" name="phi" class="classEditText">#PHILOSOPHY#</textarea>
</div>
</fieldset>
</div>
<div id="step-9">
<fieldset>
<div id="preparation">
<label for="prep" class="topLabel StepTitle">Preparation</label>
<textarea id="prep" name="prep" class="classEditText">#PREPARATION#</textarea>
</div>
</fieldset>
</div>
<div id="step-10">
<fieldset>
<div id="software">
<label for="soft" class="topLabel StepTitle">Software</label>
<textarea id="soft" name="soft" class="classEditText">#SOFTWARE#</textarea>
</div>
</fieldset>
</div>
<div id="step-11">
<fieldset>
<div id="techniques">
<label for="tech" class="topLabel StepTitle">Techniques</label>
<textarea id="tech" name="tech" class="classEditText">#TECHNIQUES#</textarea>
</div>
</fieldset>
</div>
<div id="step-12">
<fieldset>
<div id="files">
<legend class=" StepTitle">File Uploads</legend>
<label for="CCD_1"> Competency Document 1</label>
<input type="text" name="CCD_NAME_1" id="CCD_NAME_1" value="#COMPETENCYDOCLINKNAME01#"/>
<input type="file" name="CCD_1" id="CCD_1" value="#COMPETENCYDOC01#"/>
<label for="CCD_2"> Competency Document 2</label>
<label for="CCD_3"> Competency Document 3</label>
<input type="text" name="CCD_NAME_3" id="CCD_NAME_3" value="#COMPETENCYDOCLINKNAME01#"/>
<input type="file" name="CCD_3" id="CCD_3" value="#COMPETENCYDOC01#"/>
</div>
</fieldset>
</div>
</cfoutput>
</form>
</div>
这是正在传递的内容:
COURSE_NUMBER=ARH4010T&POC=&POE=&AFNorth=0&IB_Course=0
向导代码将除当前可见的 div 之外的所有 div 设置为 display:none,这应该意味着表单字段没有通过,但是在验证演示中所有字段都通过了,即使它们是 display:none
我错过了什么?