使用extremecomponents之妙
?
<ec:table items="notes" var="note" method="POST" styleborder="1" cellpadding="2" cellspacing="0"
action="?" filterable="true" sortable="true" showStatusBar="true" showExports="true" retrieveRowsCallback="limit"
sortRowsCallback="limit" filterRowsCallback="limit" showPagination="true" showTitle="true" showTooltips="true">
?
<ec:table onInvokeAction="ecTableForm.validate();">
onInvokeAction="ecTableForm.validate()"对表单列表页面增加自定义校验。
为加改属性生成默认表单提交代码:
<td><input type="text" ?name="ec_f_bargainCode" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';document.forms.ec.setAttribute('action','?');document.forms.ec.setAttribute('method','POST');document.forms.ec.submit()}" /></td>
<td><input type="text" ?name="ec_f_buyerName" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';document.forms.ec.setAttribute('action','?');document.forms.ec.setAttribute('method','POST');document.forms.ec.submit()}" /></td>
<td><input type="text" ?name="ec_f_signDate" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';document.forms.ec.setAttribute('action','?');document.forms.ec.setAttribute('method','POST');document.forms.ec.submit()}" /></td>
<td><input type="text" ?name="ec_f_amount" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';document.forms.ec.setAttribute('action','?');document.forms.ec.setAttribute('method','POST');document.forms.ec.submit()}" /></td>
<td><input type="text" ?name="ec_f_typeMean" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';document.forms.ec.setAttribute('action','?');document.forms.ec.setAttribute('method','POST');document.forms.ec.submit()}" /></td>
?
加了之后生成代码:
?
<td></td>
<td><input type="text" ?name="ec_f_bargainCode" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';javascript:alter('hello world');}" /></td>
<td><input type="text" ?name="ec_f_buyerName" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';javascript:alter('hello world');}" /></td>
<td><input type="text" ?name="ec_f_signDate" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';javascript:alter('hello world');}" /></td>
<td><input type="text" ?name="ec_f_amount" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';javascript:alter('hello world');}" /></td>
<td><input type="text" ?name="ec_f_typeMean" ?onkeypress="if (event.keyCode == 13) {javascript:document.forms.ec.ec_f_a.value='fa';document.forms.ec.ec_p.value='1';javascript:alter('hello world');}" /></td>
<td></td>
?
?
?
<SCRIPT type="text/javascript" defer="defer">
? ? ?var ecTableForm = {
? ? ? ? ? ? ? ?validate:function(){
? ? ? ? ? ? ? ? ? ? ? //校验数据
? ? ? ? ? ? ? ? ? ? ? var amountEle = $("ec_f_amount");
? ? ? ? ? ? ? ? ? ? ? var amount = amountEle.value.unFormatCurrency();
? ? ? ? ? ? ? ? ? ? ? if(!!amount){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if(isNaN(amount)){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? alert("请输入有效的金额值!");?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return;?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}else{
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? amountEle.value = amount;?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ?document.forms.ec.setAttribute('action','?');
? ? ? ? ? ? ? ? ? ?document.forms.ec.setAttribute('method','POST');
? ? ? ? ? ? ? ? ? ?document.forms.ec.submit();
? ? ? ? ? ? ? ? ? ? }
? ? ? ? };
</SCRIPT>
?
?