对于自定义的Visualforce页面中,取消按钮点击时会对必填字段进行验证,若要取消按钮点击时的验证,需要在 该按钮的定义中加入“immediate=true”的属性:
如:<apex:commandButton value="Cancel" action="{!Cancel}" title="Cancel" immediate="true" />
对于要在脚本中取的值,需在页面中的脚本事件中如此添加参数:{!$component.元素id},
在脚本中用document.getElementById(参数):
如:
<apex:selectList size="1" value="{!accountName}" id="accid" required="true"
οnselect="{!accountid}" οnclick="return accSelect('{!$Component.accid} ') ;" >
</apex:selectList>