Checkbox checked, disabled it
Copy link to clipboard
Copied
Please, will you help me?
I need disable a checkbox with javascript after it has been selected, I did the next :
I selected a rows from Postgres DB for create the checkbox. I use a Perl languaje in Linux Centos 7, the code is next:
while(my $ref_alarm = $sth->fetchrow_hashref()) {
($gabinete)=$ref_alarm->{'gabinete'};
($alarma)=$ref_alarm->{'descrip_alarma'};
print "<input type='checkbox' name='alarma' id='alarma' value='$alarma' onclick='alarma_reg(this.value);'/>$alarma</input>";
print "<br>";
}
I had been use javascript for disable the checkbox that had been selected:
function alarma_reg(p_alarma) {
//Get the checkbox
document.getElementById("p_alarma").disabled = true;
alarma_operada+=p_alarma + ',';
document.getElementById("ver_alarmas").value=alarma_operada;
}
But the option selected is not disable, please could you help me?
Regards
Xochitl
Copy link to clipboard
Copied
You want it to be 'readonly' if it's checked?
How do you check it, manually or with a code from somewhere else?
Do you have condition to uncheck it?
Copy link to clipboard
Copied
You want it to be 'readonly' if it's checked?
Yes, when the user check the checkbox it's state must to change to disable o readonly.
How do you check it, manually or with a code from somewhere else?
I checked manually
Do you have condition to uncheck it?
The condition is, when it's selected then change the checkbox state to disable. So, the user will can't select anymore.
Copy link to clipboard
Copied
Does you use a HTML form?
Copy link to clipboard
Copied
Yes. I had been use a HTML FORM.
Copy link to clipboard
Copied
You are posting in a wrong forum.
Copy link to clipboard
Copied
Your script is not a regular PDF-JavaScript.
Place this script in the checkbox as a MouseUp action:
if (event.target.value) != "Off") {event.target.readonly = true;}
Acrobate du PDF, InDesigner et Photoshoptographe
Copy link to clipboard
Copied
Thanks for answered but sorry I don't what is a PDF-JavaScript.
Sorry.
Regards

