The code is not fully clear to me, so hard to provide proper guidance. As mentioned before, I think there are some errors in the code as you posted it here, but not sure if that influences the working. If you can work with someone and see the JavaScript code in the final HTML, and debug where the code works and where it breaks, I'd think there is a good chance that this code may work with some fixes. Maybe good to go back to where you got this code and see if the original author knows what to do.
If you have urgent issues, always contact your HPE Aruba Networking partner, distributor, or Aruba TAC Support. Check
for how to contact HPE Aruba Networking TAC. Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or HPE Aruba Networking.
In case your problem is solved, please invest the time to post a follow-up with the information on how you solved it. Others can benefit from that.
Original Message:
Sent: Dec 20, 2024 02:32 PM
From: Jose Marcio
Subject: Portal Guest Clearpass
I adjusted the error there but it still didn't work, I'm including this code in the guest footer where I'm inserting the source code

Original Message:
Sent: Dec 19, 2024 09:47 AM
From: Herman Robers
Subject: Portal Guest Clearpass
Unsure where you got this from, but it looks like injected JavaScript, but it looks I'm missing a lot of context like where you add this code, how the page renders in the end, if there are JavaScript errors in the JavaScript console, etc... If you find someone who understands JavaScript, it may be trivial to work back from the generated HTML/script code to where you should change things. At the end, there is a {/literal) where the { should end with } not with ); and I don't see that code that you remove at all in the code above.
If someone else has done this before: please respond with how you did this.
------------------------------
Herman Robers
------------------------
If you have urgent issues, always contact your HPE Aruba Networking partner, distributor, or Aruba TAC Support. Check https://www.arubanetworks.com/support-services/contact-support/ for how to contact HPE Aruba Networking TAC. Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or HPE Aruba Networking.
In case your problem is solved, please invest the time to post a follow-up with the information on how you solved it. Others can benefit from that.
Original Message:
Sent: Dec 16, 2024 06:48 PM
From: Jose Marcio
Subject: Portal Guest Clearpass
Hello goodnight!
I need help from the community. We have a routine in ClearPass to make the portal captive with a CPF validation (used in Brazil).
The routine is working and validating the check digits correctly. However, when I include a part of the routine so that the field where the CPF is entered only accepts numbers, the routine does not validate the check digit.
Could anyone help me with this issue?
Written routine
<script>
{literal}
// Verifica CPF V.0.1d
// Código criado por Renato Cinini
// Aruba Networks Brasil - V.0.1 - AGOSTO 2015
// Testado no ClearPass Guest versão 6.5.2.31706
var fieldName = "cpf_id";
function RegisterSubmit(form_name) {
var tid = new Number();
tid = document.forms[form_name][fieldName].value;
var digits = [];
for (var i = 0, len = tid.length; i < len; i += 1) {
digits.push(Number(tid.charAt(i)));
}
// Testando se o CPF tem onze numeros
if (!tid.match(/^[0-9]{11}$/)) {
declareInvalid(form_name, 'Por favor, digite somente os 11 números.');
return false;
}
// Verifica se nenhuma das sequências inválidas abaixo
else if (tid == '00000000000' ||
tid == '11111111111' ||
tid == '22222222222' ||
tid == '33333333333' ||
tid == '44444444444' ||
tid == '55555555555' ||
tid == '66666666666' ||
tid == '77777777777' ||
tid == '88888888888' ||
tid == '99999999999') {
declareInvalid(form_name, 'Número ilegal.');
return false;
}
// Verifica 1o dígito
add = 0;
for (i=0; i < 9; i ++)
add += parseInt(tid.charAt(i)) * (10 - i);
rev = 11 - (add % 11);
if (rev == 10 || rev == 11)
rev = 0;
if (rev != parseInt(tid.charAt(9))) {
declareInvalid(form_name, '1o dígito verificador não confere.');
return false;
}
// Verifica 2o dígito
add = 0;
for (i = 0; i < 10; i ++)
add += parseInt(tid.charAt(i)) * (11 - i);
rev = 11 - (add % 11);
if (rev == 10 || rev == 11)
rev = 0;
if (rev != parseInt(tid.charAt(10))) {
declareInvalid(form_name, '2o dígito verificador não confere.');
return false;
}
return true;
}
// Função para feedback visual - célula vermelha e aviso
// Para remover o aviso comente a segunda linha abaixo (alert...) com //
function declareInvalid(form_name, ruleBroken) {
alert("CPF inválido: " + ruleBroken);
var tidField = document.forms[form_name][fieldName];
tidField.style.border = "2px solid red";
When I remove these lines below the routine works but the field format is string and not numeric
{/literal}
<script>$('imput[name="cpf_id"]'),attr('inputmode','numeric') ;< /script>{/literal)
</script>