Coldfusion表格没有更新数据库

时间:2010-09-16 13:55:19

标签: forms coldfusion

我有一个表单,在同一页面上更新它...这个表格上周工作,我没有触及代码全部。有什么可以改变的? :\

“它不起作用......”,因为......一旦提交了信息,数据库中的信息就不会更新。 :\

注意:我知道我需要用cfparam替换东西...不要担心那部分。

另一个注意:此页面包含在选项卡区域(jquery UI选项卡)

我试图用firebug调试这个...但我没有错误......:\

以下是代码:

<!-- Submit form handles -->
<cfif isdefined("form.buttonGen")>

  <cfparam name="form.TeachingLevel" default="None">
  <cfif #form.FundSource# IS 'Other'>
    <cfset form.FundSource = #form.FundSourceOther#>
  </cfif>

  <cfquery name="savePeople" datasource="#sacsds#" username="#sacsuser#" password="#sacsuser#">
  UPDATE faculty.dbo.SACS_Person
  SET Status = '#form.Status#',
  FundSource = '#form.FundSource#',
  TeachingLevel = '#form.TeachingLevel#',
  TeachingFields = '#form.TeachingFields#',
  MeetsReq = '#form.MeetsReq#', 
  GraduateHours = '#form.GraduateHours#',
  MeetsQual = '#form.MeetsQual#',
  Justification = '#form.Justification#'
  WHERE IDNum = <cfqueryparam cfsqltype="cf_sql_varchar" value="#session.fperson#"> AND
  DeptCode = '#session.DeptCode#'
  </cfquery>


<cfif ISDEFINED("form.VitaFile") AND form.VitaFile IS NOT ''>


    <cffile action="upload" filefield="form.VitaFile" destination="#VitaLoc#" nameconflict="makeunique">
    <cfset form.VitaURL = "#VitaPath#/#cffile.serverfile#">
        <cfquery name="saveVita" datasource="#sacsds#" username="#sacsuser#" password="#sacsuser#">
        UPDATE faculty.dbo.SACS_Person
         SET vitaURL =   '#form.vitaURL#'
         WHERE idnum LIKE '#form.idnum#'
        AND  deptCode LIKE '#form.deptCode#'
        </cfquery>

</cfif>



</cfif>
<div id = "dialog2">
<b>Saved.</b> 
</div>





<!-- The form -->
<cfif session.security GT 1>
<h3><cfoutput>#getP.FullName#</cfoutput></h3>
<cfform  name="form1" enctype="multipart/form-data" id = "docForm" >
<table class = "general">
  <tr>
    <td><strong>Status</strong></td>
    <td><cfinput type="radio" name="Status" value="Regular Faculty" checked="checked" />
      Regular Faculty
      <cfif results.Status IS "Visiting Faculty"><cfinput type="radio" name="Status" value="Visiting Faculty"  CHECKED />
      <cfelse>
      <cfinput type="radio" name="Status" value="Visiting Faculty" />
      </cfif>
        Visiting Faculty<br />
      <cfif results.Status IS "Adjunct">
        <cfinput type="radio" name="Status" value="Adjunct" CHECKED />
        <cfelse>
        <cfinput type="radio" name="Status" value="Adjunct" /></cfif>
        Adjunct
      <cfif results.Status IS "Graduate or Teaching Assistant">
        <cfinput type="radio" name="Status" value="Graduate or Teaching Assistant" CHECKED />
      <cfelse>
        <cfinput type="radio" name="Status" value="Graduate or Teaching Assistant" />
      </cfif>
    Grad or Teaching Asst </td>
  </tr>
  <tr>
    <td><strong>Funding Source</strong></td>
    <td>
    <cfinput type="radio" name="FundSource" value="EG" checked="checked" />
      E&amp;G
      <cfif results.FundSource IS "Grant Contract">
      <cfinput type="radio" name="FundSource" value="Grant Contract" CHECKED />
      <cfelse>
      <cfinput type="radio" name="FundSource" value="Grant Contract" />
      </cfif>
      Grant Contract
      <cfif results.FundSource IS "Auxiliary">
      <cfinput type="radio" name="FundSource" value="Auxiliary" CHECKED />
      <cfelse>
      <cfinput type="radio" name="FundSource" value="Auxiliary" />
      </cfif>
      Auxiliary<br />
      <cfif results.FundSource IS NOT "Grant Contract" AND results.FundSource IS NOT "Auxiliary" AND results.FundSource IS NOT "EG">
      <cfinput type="radio" name="FundSource" value="Other" CHECKED />
      <cfelse>
      <cfinput type="radio" name="FundSource" value="Other" />
      </cfif>
      Other:
     <cfif results.FundSource IS NOT "Grant Contract" AND results.FundSource IS NOT "Auxiliary" AND results.FundSource IS NOT "EG">
     <cfoutput>
    <cfinput type="text" name="FundSourceOther" size="35" value="#results.FundSource#" />
    </cfoutput>
    <cfelse>
    <cfinput type="text" name="FundSourceOther" size="35" value="" />
    </cfif>
    </td>
  </tr>
  <tr>
    <td><strong>Teaching Levels</strong></td>
    <td>
    <cfif FindNoCase('Lower Division', #results.TeachingLevel#) IS NOT 0>
    <cfinput type="checkbox" name="TeachingLevel" value="Lower Division" CHECKED />
    <cfelse>
    <cfinput type="checkbox" name="TeachingLevel" value="Lower Division" />
    </cfif>
      Lower Division
    <cfif FindNoCase('Masters', #results.TeachingLevel#) IS NOT 0>
    <cfinput type="checkbox" name="TeachingLevel" value="Masters" CHECKED />
    <cfelse>
    <cfinput type="checkbox" name="TeachingLevel" value="Masters" />
    </cfif>
    Master's
    <cfif FindNoCase('Doctorate', #results.TeachingLevel#) IS NOT 0>
    <cfinput type="checkbox" name="TeachingLevel" value="Doctorate" CHECKED />
    <cfelse>
    <cfinput type="checkbox" name="TeachingLevel" value="Doctorate" />
    </cfif>
    Doctorate<br />
    <cfif FindNoCase('Upper Division', #results.TeachingLevel#) IS NOT 0>
    <cfinput type="checkbox" name="TeachingLevel" value="Upper Division" CHECKED />
    <cfelse>
    <cfinput type="checkbox" name="TeachingLevel" value="Upper Division" />
    </cfif>
    Upper Division
    <cfif FindNoCase('Specialist', #results.TeachingLevel#) IS NOT 0>
    <cfinput type="checkbox" name="TeachingLevel" value="Specialist" CHECKED />
    <cfelse>
    <cfinput type="checkbox" name="TeachingLevel" value="Specialist" />
    </cfif>
    Specialist
    <cfif FindNoCase('None', #results.TeachingLevel#) IS NOT 0>
    <cfinput type="checkbox" name="TeachingLevel" value="None" CHECKED />
    <cfelse>
    <cfinput type="checkbox" name="TeachingLevel" value="None"  />
    </cfif>
    None </td>
  </tr>
  <tr>
    <td><strong>Teaching Fields</strong></td>
    <td><cfinput type="text" name="TeachingFields" size="35" value="#results.TeachingFields#"></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><strong>Meets faculty requirements based upon advanced academic work in the teaching fields.</strong><br />
      &nbsp;
      <cfinput type="radio" name="MeetsReq" value="Yes" checked="checked" />
      Yes
      <cfif results.MeetsReq IS "No">
      <cfinput type="radio" name="MeetsReq" value="No" CHECKED />
      <cfelse>
      <cfinput type="radio" name="MeetsReq" value="No"  />
      </cfif>

    No </td>
  </tr>
  <tr>
    <td colspan="2" align="center"><strong>Graduate semester hours in teaching field</strong>
      <br />
      <cfinput type="radio" name="GraduateHours" value="0-17" checked="checked" />
      0-17
      <cfif results.GraduateHours IS "18-29">
      <cfinput type="radio" name="GraduateHours" value="18-29" CHECKED />
      <cfelse>
      <cfinput type="radio" name="GraduateHours" value="18-29" />
      </cfif>
      18-29
      <cfif results.GraduateHours IS "30+">
      <cfinput type="radio" name="GraduateHours" value="30+" CHECKED />
      <cfelse>
      <cfinput type="radio" name="GraduateHours" value="30+" />
      </cfif>
      30 and above </td>
    </tr>
  <tr>
    <td colspan="2" align="center"><strong>Meets qualifications based upon &quot;demonstrated competencies and achievements that contribute to effective teaching and student learning outcomes&quot; in lieu of advanced academic preparation.</strong><br />
      <cfinput type="radio" name="MeetsQual" value="Yes" checked="checked" />
      Yes
      <cfif results.MeetsQual IS "No">
      <cfinput type="radio" name="MeetsQual" value="No" CHECKED />
      <cfelse>
      <cfinput type="radio" name="MeetsQual" value="No" />
      </cfif>
        No </td>
  </tr>
  <tr>
    <td colspan="2" align="center"><strong>If &quot;yes&quot;, describe the manner in which the competence and achievement were demonstrated. If &quot;no,&quot; describe the circumstances justifying the hiring.</strong>

      <br />
      <br />
      <cftextarea name="Justification" cols="70" rows="5"><cfoutput>#results.Justification#</cfoutput></cftextarea>
      </td>
  </tr>
  <tr>
    <td colspan="2" align="center">
      <cfinput type="submit" name="buttonGen" id="buttonGen"  value="Save Changes"  />
      </td>
  </tr>
</table>
<cfoutput>
<cfinput type="hidden" name="VitaURL" value="#results.VitaURL#">
<cfinput type="hidden" name="CollegeCode" value="#session.CollegeCode#">
<cfinput type="hidden" name="DeptCode" value="#session.DeptCode#">
<cfinput type="hidden" name="IDNum" value="#session.fperson#">
</cfoutput>
</cfform>
<cfelse>
</cfif>

1 个答案:

答案 0 :(得分:0)

显然,告诉用户内容已保存的jquery对话框阻止了查询的运行。奇怪......哦,没有漂亮的对话。 :\不适合我的事情。我必须通过ajax做我的表单...我会这样做,但我没有时间。谢谢大家...

PS:我会研究我的编码风格。 :)