在页面设计开发中,我们可能需要对AutoForm进行设置或者更改,但是因为在客户端并没有AutoForm对象,所以没有办法直接可以使用AutoForm对象进行操作,如果要对AutoForm进行处理方法如下:
AutoForm中有Group,Group中又可以有Label,TextdEitor,Label,Element Renderer等。
我们一般情况下对AtuoForm中的对象进行操作,有隐藏/只读两种。
1.Group
FormGroup的id的生成规则是:AutoForm ID_group+index,其中index为Group的顺序,从0开始。
比如该示例的第二个FormGroup的ID是formEmployee_group1
其它group可以自己命名,访问的时候可以用autoForm名_group名。
2.Label,TextEditor,Label,Element Renderer等
FieldLabel的ID为: formName_fieldlabel_fieldName
TextEditor以及CheckBox的ID为: formName_eidtor_fieldName
Label的ID为:formName_label_fieldName
Element Renderer的ID为:formName_groupName_ElementName_renderer
然后对于group 或者Label,TextEditor,Label,Element Renderer的操作可以这样子
document.getElementById("formName_fieldlabel_fieldName").style.display="none"//隐藏(一般fieldlabel和eidtor都要隐藏)
document.getElementById("formEmployee_group1").style.display="block"//显示
document.getElementById("formName_eidtor_fieldName").setReadOnly(true);