Why doesn’t it change the edge of the input

Asked

Viewed 545 times

1

The input confirmarsenha_cadastro should stick with the red border but this is not happening, why?

    </script>
    $(function() 
    {
        var dialog, form,
        dialog = $( "#painel_logar_registrar" ).dialog
        ({
          autoOpen: false,
          height: 400,
          width: 480,
          modal: true,
        });

        $( "#login_cadastro_index" ).button().on( "click", function()
        {
          dialog.dialog( "open" );
        });
    });

    function testarcampos()
    {
        if(form_cadastro.senha_cadastro.value != form_cadastro.confirmarsenha_cadastro.value)
        {
            form_cadastro.confirmarsenha_cadastro.style.borderColor = "#FF0000";
        }
    }

</script>

  <div id="painel_logar_registrar">
        <form method="post" action="fazer_cadastro.php" id="form_cadastro" name="form_cadastro" enctype="multipart/form-data">
      <table width="155" border="0" align="right" id="tabela_cadastro">
        <tr>
            <td width="149" align="center" bgcolor="#FFFFFF" class="csslogin">REGISTRAR</td>
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">LOGIN</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="login_cadastro"></label>
            <input width="200" type="text" name="login_cadastro" id="login_cadastro" />
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">EMAIL</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="email_cadastro"></label>
            <input width="200" type="text" name="email_cadastro" id="email_cadastro" /></td>
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">SENHA</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="senha_cadastro"></label>
            <input width="200" type="password" name="senha_cadastro" id="senha_cadastro" /></td>
          </tr>
          <tr>
            <td height="22" class="fontes_login_cadastro" align="left" valign="bottom">CONFIRMAR SENHA</td>
          </tr>
          <tr>
            <td id="design_geral_escrita" height="22" align="left">
            <label for="confirmarsenha_cadastro"></label>
            <input width="200" type="password" onBlur="testarcampos(this.value)" name="confirmarsenha_cadastro" id="confirmarsenha_cadastro" /></td>
          </tr>
          <tr>
            <td id="design_geral_escrita2" height="22" align="center">
            <input type="submit" name="cadastrar" id="button_cadastrar" value="CADASTRAR" /></td>
          </tr>
            </table> 
        </form>
    </div>

    <div id="painel_fazer_upload">
        <form action="fazer_upload.php" enctype="multipart/form-data" method="post">
            <input name="arquivo" id="arquivo" type="file">
            <input id="qualquer" type="submit">
        </form>
    </div> 
  • When you call the function "testarcampos"?

  • in onBlur of the "confirm registration"

  • Here it is working, it is not to fill the field of the password and when changing input it stay with the red border?

1 answer

2


I believe that this element does not have the property border, is only passing the color with borderColor, that is, it does not find edge to apply this color.

Then you create the border by passing your size, style and color with style.border

Try it like this:

function testarcampos()
    {
        if(form_cadastro.senha_cadastro.value != form_cadastro.confirmarsenha_cadastro.value)
        {
            form_cadastro.confirmarsenha_cadastro.style.border = "1px solid #FF0000";
        }
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.