Copy link to clipboard
Copied
Hello
I have 3 checkboxes for class timings and the person can only choose 1 of the 3.
Depending on the checkbox ticked, a text field at the bottom (called (txtOfficeClass) is filled with text.
I have searched the forum and placed the following scripts (mouseup) in each check box. It works, but i want to know if i have done in correctly (in case something wrong happens in the future)
CheckBox 1
(function ()
{ // Get a reference to the text field var f = getField("txtOfficeClass"); if (event.target.value === "Off") {
f.value = ""; // Blank the statement field
f.readonly = false; // Allow user to enter text } else {
f.value = "CLASS 1 (16:30 TO 18:00)"; // Set field text
f.readonly = true; // Don't allow user to enter text }
})();
 
ok
Copy link to clipboard
Copied
The code contains a couple of unnecessary items that affect efficiency, rather than function. And it's poorly formatted, which I'm sure is an artifact of pasting it directly into the forum message. Still, it'd be helpful if you would clean up your code formaating and use the "code box", so we can easily see what's actually going on.
1. There is no reason to put this code in the function format.
2. There is no reason to use the identity operator for testing the checkbox value.
Otherwise, it looks great.
Copy link to clipboard
Copied
 I just changed the check box to a radio button as it was selecting more than one option on mobile.
The code box is below after following your changes. Thanks
 
Copy link to clipboard
Copied
Looks good, but how well does it work on mobile? And by mobile, do you mean the Adobe Mobile Reader?
Copy link to clipboard
Copied
This one works well on mobile.
But if i use check boxes instead of radio buttons then i can't select only one option. After selecting option 1 i can select option 2 and 3 aswell. Once all 3 are selected, if i deselect option 1, then it will deselect all 3.
Copy link to clipboard
Copied
I mean adobe mobile
Copy link to clipboard
Copied
So, just to be clear, when you use checkboxes that are setup to be mutually exclusive (i.e. the checkbox fields all have the same name, but different exports), the behavior is mutually exclusive on the desktop Acrobat, but has the wierd non-exclusive behavior on the Mobile Acrobat?
If true, then this is a bug in the mobile Acrobat Reader. There's nothing you can do to change it.
Please post a bug report:
https://www.adobe.com/products/wishform.html
Copy link to clipboard
Copied
ok