我遇到SartajPHP选择控件的问题。它无法从数据库中获取数据。实际上这是我编辑或插入新记录的员工表格。我使用了面板,制表符和表单控件。一切都运作良好,但在选择我需要选择员工身份的领域。我试图从数据库中获取员工的当前状态。所以在尝试渲染临时文件时。它给出了由Select Control生成的SQL查询错误。我不知道该怎么做。这是我的临时文件代码..
<panel id="pnlEdit" funsetLabel="Edit Employee" runat="server" path="controls/bootstrap3/EditPanel.php">
<div id="tab1" runat="server" path="controls/bootstrap3/Tabs.php" >
<tabhead runas="ul" class="nav nav-tabs">
<li class=""><a data-toggle="tab" href="#sectionA">GENERAL</a></li>
<li class=""><a data-toggle="tab" href="#sectionB">DEPARTMENTS</a></li>
<li class=""><a data-toggle="tab" href="#sectionC">WORK LIST</a></li>
</tabhead>
<tabcontent runas="div" class="tab-content">
<sectionA runas="div" id="sectionA" class="tab-pane fade">
<form id="form2" class="form-horizontal form-striped" runat="server" funsetAJAX="" action="##{ getAppPath('user'); }#">
<label id="lbl1" path="controls/bootstrap3/HLabel.php" fupsetLabel="First Name,|txtfname" runat="server" funsetSize="col-md-4,|col-md-8">
<input id="txtfname" runat="server" type="text" dfield="txtfname" class="form-control" funsetForm="form2" funsetMsgName="First Name" funsetMaxLen="40" funsetRequired="" />
</label>
<label id="lbl1" fupsetLabel="Last Name,|txtlname" runat="server" >
<input id="txtlname" runat="server" type="text" dfield="txtlname" class="form-control" funsetForm="form2" funsetMsgName="Last Name" funsetMaxLen="40" funsetRequired="" />
</label>
<label id="lbl1" fupsetLabel="Email,|emlemail" runat="server" >
<input id="emlemail" runat="server" type="text" dfield="emlemail" class="form-control" funsetForm="form2" funsetMsgName="Email" funsetMaxLen="100" funsetEmail="" />
</label>
<label id="lbl1" fupsetLabel="Pin,|numpin" runat="server" >
<input id="numpin" runat="server" type="text" dfield="numpin" class="form-control" funsetForm="form2" funsetMsgName="Pin" funsetMaxLen="11" funsetNumeric="" />
</label>
<label id="lbl1" fupsetLabel="Current Status,|sltcurrent_status" runat="server" >
<select id="sltcurrent_status" runat="server" dfield="sltcurrent_status" class="form-control" funsetForm="form2" funsetMsgName="Current Status" funsetOptionsFromTable="astatus,atype,where id='##{$page->evtp}#'" ></select>
</label>
<label id="lbl1" fupsetLabel="Allow Change Team,|chkCanchangeteams" runat="server" >
<input id="chkCanchangeteams" type="checkbox" runat="server" dfield="chkCanchangeteams" class="form-control" funsetForm="form2" funsetMsgName="Allow Change Team" />
</label>
<div class="align-center"><br /><input type="submit" value="Save" class="btn btn-primary btn-small" />
<input type="reset" value="New" class="btn btn-primary btn-small" onclick="setFormAsNew('form2');" />
<input id="btnDel" runat="server" type="button" value="Delete" onclick="confirmDel_showall('##{ getEventPath('delete',$page->evtp,'user','','',true); }#');" class="btn btn-danger btn-small" />
</div>
</form>
</sectionA>
<sectionB runas="div" id="sectionB" class="tab-pane fade">
........
.....
</sectionB>
</tabcontent>
</div>
它给了我sql语法错误。
答案 0 :(得分:1)
您将错误的参数传递给Select Control功能。你需要至少给出表名..
<label id="lbl1" fupsetLabel="Current Status,|sltcurrent_status" runat="server" >
<select id="sltcurrent_status" runat="server" dfield="sltcurrent_status" class="form-control" funsetForm="form2" funsetMsgName="Current Status" funsetOptionsFromTable="astatus,|atype,|mytable,|where id='##{$page->evtp}#'" ></select>
</label>
使用此代码进行了更改..
@Override protected void onFinishInflate() {
super.onFinishInflate();
DataBindingUtil.bind(this);
}
有关详情,请查看SartajPHP Framework API http://www.sartajphp.com/api/classes/Select.html#method_setOptionsFromTable