Acrobat Javascript - Selecting Radio Buttons in a group individually

Explorer ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hi everyone,

 

I´m struggling to find a solution to this.

 

I´ve created a group of 4 Radio Button (say Group1). ONly one Radio Button contains the the right answer.

Problem 1:

I need a dialog box to pop up everytime one Radio Button is selected.

 

Problem 2:

I need the checking of the Radio Button to be cleared, in case the answer is wrong.

 

Problem 3:

I need the Radio Buton to remain checked, in case the answer is correct.

 

Thank you very much for your help/direction you can give me on this.

 

Cheers,

 

Andre Salles

TOPICS
Create PDFs, JavaScript, PDF forms

Views

172

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

As Mouse UP event of Radio Button use this to get dialog box ( I assume you want an alert that answer is wrong/correct?)

app.alert("This choice is wrong/correct.", 3);

Edit message in alert as you see fit.

As Mouse Exit event of same Radio Button use this to clear Button:

event.target.value = "Off";

Don't use it in button with correct answer.

Repeat for other buttons.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hi Nesa,

 

Thanks a lot for your answer. You understood exactly what I wanted.

I did as you said and everything worked fine, EXCEPT for the Mouse Down event.

I inserted the "event.target.value = "off"" on it, but nothing happens. The button remains unchecked.

I also tried to invert and wrote "event.target.value = "On"" only on the button that contained

the right answer, leaving all the other blank, but again, to no avail.

Do you have any idea what might be causing this problem?

Would appreciate to receive your comments.

 

Cheers,

 

Andre Salles

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

It's "Mouse Exit" not "Mouse Down".

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Oh sorry. I just inserted the code correctly.

I inserted the same code on Mouse Exit but still, nothing happens.

Actually, since I starting inserted Javascript on each radio button, all of them remain

unchecked, no matter what.

Because I need all the Radio button to be cleared as soon as the user opens the PDF, I

inserted a code clearing all of them. This code runs on page loading.

I don´t know if this is interfering somehow.

Thanks a lot in advance for any help.


Cheers,

 

Andre Salles

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

What code did you set as Document level?

Can you share your file here?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Sure.

 

qte

this.getField("Group1").value = "Off"

unqte

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

LATEST

If you can, upload your file to google drive or similar site and post link here so I can take a look into your file or you can send it to me privately if you don't want to post it here at nesa.nurani@gmail.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines