public class DOInputText extends DOBaseForm {
@Override
public String getHtmlCode(DOIModel aModel) {
DOFormModel fm = (DOFormModel) aModel;
StringBuffer buffer = new StringBuffer();
///onkeypress='if(event.keyCode==13||event.which==13){return false;}' 加上这个可以阻止上文所说的内容
buffer
.append(
"<input style='border:#B3B3B3 1px solid;' onclick=\"this.style.borderColor='#406B9B'\" onmouseover=\"this.style.borderColor='#99E300'\" onmouseout=\"this.style.borderColor='#A1BCA3'\" type='text' name='")
.append(fm.getColName()).append("' id='").append(
fm.getFullColID()).append("'");
buffer.append(getDecoration(fm));
buffer.append(" title='").append(fm.getL10n().trim()).append("'");
String theValue = fm.getValue();
DOPaneModel cPaneModel = null;
if (fm.getGridModel() != null) {
cPaneModel = fm.getGridModel().getContainerPane();
}
if (theValue != null) {
buffer.append(" value='").append(theValue).append("'");
}
if (isReadOnly(fm)) {
buffer.append(" readonly='readonly' ");
}
if(fm.getExedojoType() != null && fm.getExedojoType().trim().length()>0) {
String maxlen = fm.getExedojoType().trim();
if(maxlen.startsWith(";")){
maxlen = maxlen.substring(1).trim();
if(maxlen.matches("^\\d+$")) {
buffer.append(" maxlength='").append(maxlen).append("' ");
}
} else if("MoBile".equals(maxlen)) {
buffer.append(" maxlength='11' ");
}
}
buffer.append(this.appendValidateConfig(fm));
appendHtmlJs(buffer, fm);
buffer.append(" size=\"").append(getInputSize(fm)).append("\"/>");
if (fm.isNotNull()) {
buffer.append(" <font color='red'>*</font>");
}
if (fm.getNote() != null && !"".equals(fm.getNote())) {
if (fm.getStyle() != null && !"".equals(fm.getStyle())) {
buffer.append(" <span style=\"").append(
fm.getStyle()).append("\">").append(fm.getNote())
.append("</span>");
} else {
buffer.append(fm.getNote());
}
}
return buffer.toString();
}