I'm trying to call a JavaScript function through OnClientClick
.
The problem is that when running in the browser it does not validate the fields, it is as if the function was simply not called.
JavaScript:
function VerificaCampos() {
//verifica processo
var ddlprocesso = document.getElementById("<%=ddlProcesso.ClientID%>")
if (ddlempresa.options[ddlprocesso.selectedIndex].value == ""){
alert("Favor preencher processo!");
ddlprocesso.focus();
return false;
Button:
<asp:Button ID="btnBuscar" runat="server" CssClass="botao"
Text="Gerar" OnClientClick="if(VerificaCampos()) return false;"
OnClick="btnBuscar_Click"/>