I want to do a simple thing: I want to compare the data from two fields on input. I mean: the user will fill a field with his password and there will be another field asking him to fill his password again. I want to compare these two datas to see if they match.. My problem is that I don't know how to retrieve the data from the confirmation field to compare it. Relevant part of the code is here (confirmaSenha is the confirmation field):
{name:'senha', width:80, sortable:true, editable: true, hidden:true, edittype:'password', editrules:{edithidden:true, required:true, custom:true, custom_func:validaSenha}},
{name:'confirmaSenha', width:80, sortable:true, editable: true, hidden:true, edittype:'password', editrules:{edithidden:true, required:true}},
function validaSenha(value, colname){
if (colname=='senha' && value == HOW_DO_I_GET_DATA_FROM_CONFIRMATION_FIELD?) {
return [true, ""];
}
else {
return [false, ""];
}
}
EDITED
if ((colname == 'senha') && (value == $('#tr_confirmaSenha').val())) {
alert('true');
return [true, ""];
}
else {
var senha = $("#tr_confirmaSenha").val();
alert(senha);
$("td.editmsg", 'FrmGrid_grid').html("Senhas diferentes.");
return [false, ""];
}
}
Thanks in advance.
FALSE
? (As compared tofalse
...) – Gastroenterology