0
I’m trying to pass a string and an int in a JS for it to return me in a modal and I see this error below, someone could help me?
Trying to pass values here on td to JS and he needs to return it to me in modal. Obs: using java spring to bring this values from the database
<td><a href='#' onclick="setaDadosModal(nome, numero)" data-toggle="modal" data-target="#con-close-modal-altera"><i class="fa fa-pencil"></i></a></td>
My modal
<div id="con-close-modal-altera" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Alterar Modalidade</h4>
</div>
<form name="alterarModalidade" action="alteraModalidades" method="post" role="form">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input required="" name="idModalidades" type="hidden" id="alteraIdModalidade" class="form-control">
<input required="true" name="nomeModalidadeTemp" type="text" id="alteraNomeModalidadeTemp" class="form-control" id="exampleInputEmail1" placeholder="Digite a modalidade a ser alterada" maxlength="30">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal">Fechar</button>
<button type="submit" onclick="return alterarModal()" class="btn btn-warning waves-effect waves-light">Alterar</button>
</div>
</form>
</div>
</div>
</div>
My JS
function setaDadosModal(AltnomeModalidade, AltidModalidade) {
document.getElementById('alteraNomeModalidadeTemp').value = AltnomeModalidade;
document.getElementById('alteraIdModalidade').value = AltidModalidade;}
My Mistake
modalities:258 Uncaught Referenceerror: aaaa is not defined at Htmlanchorelement.onclick (modalities:258)
Row 258 the error refers to
<td><a href='#' onclick="setaDadosModal(aaaa, 107)" data-toggle="modal" data-target="#con-close-modal-altera"><i class="fa fa-pencil"></i></a></td>
Man, thank you so much for the help and explanation, it was just that, what a silly little mistake.
– user98426