Hello. I have developed a process bar with a next button and preview, where clicking the next bar will reduce the processes.
I have 2 fields on the screen, "position" and "totalItems", where position must be less than or equal to totalItems.
My problem is that my bar has 3 sessions and a total of items, when the first section ends the counter understands that the bar has finished and does not continue counting positions, stating that the document is in the first record.
So ...
The first session has 9 items, then the button goes from 0 to 8, where 8 > 78 = false. But the next position, which would be 9 the comparison 9 > 78 = true and displays the alert.
By putting a console.log I see that the result of the fields are correct, one with value 8 and another with the value 78, which is the total of items.
bindEvent("click",".next",function(event){
event.preventDefault();
var indicator = $("input[name='indicator']").val(),
position = $("input[name='position']").val(),
totalItens = "<cfoutput>#arrayLen(session.Propostas)#</cfoutput>"; //Pega o total de itens em uma sessão do CF = 78
if(position >= totalItens){
alert("Você está no último registro");
}
else{
//increment +1
position++;
$("input[name='position']").val(position);
//Tira 1 do total de itens
$("input[name='indicator']").val(("<cfoutput>#arrayLen(session.Propostas)#</cfoutput>")-position);
.
.
.
}
}
Does anyone have any idea what might be happening?