checkbox, radio button validator
我竟然漏左post 呢個咁important 既post, 就係checkbox, radio button 既validator:
貼係header 度~~再用customer validator 就得~~ very easy and useful ~~ excellent !!! ^^
<script type="text/javascript">
//– To Validate CheckBoxList
function ChequarSelecciondeTipoModificacion(source, args)
{
var chkListaTipoModificaciones= document.getElementById (‘<%= rbGift.ClientID %>’);
var chkLista= chkListaTipoModificaciones.getElementsByTagName(“input");
for(var i=0;i<chkLista.length;i++)
{
if(chkLista[i].checked)
{
args.IsValid = true;return;
}
}
args.IsValid = false;
}
</script>
+++++++++++++++++++++++++++++++++++++++++
<asp:RadioButtonList ID="rbGift" runat="server">
<asp:ListItem Value="手機">手機</asp:ListItem>
<asp:ListItem Value="短褲">短褲</asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
<asp:CustomValidator ID="cv1″ runat="server" ErrorMessage="必須選擇一項"
ClientValidationFunction="ChequarSelecciondeTipoModificacion" Font-Size="Small"></asp:CustomValidator>
Entry filed under: Uncategorized. Tags: checkbox, radio button, validator.
Trackback this post | Subscribe to the comments via RSS Feed