Script to automatically calculate answers to the questions of the option button?
Hello
Anyone know if its possible / how to write a script to automatically count the responses of the radio buttons?
For example, I have a form with 14questions, where the answers are either "Yes" 'Unknown' and 'No' - I used for each question radio buttons.
At the bottom of the form, I want it to be automatically calculate how much 'yes' 'unknown' and 'No' responses there. (ie. a text box that displays the number of 'Yes', another area of text that displays the number of 'No'... etc)
Can someone help me with this?
Thank you so much
OK, for the text field that counts the groups of numbers with the Yes option radio button is selected, you can use code like:
// Custom Calculate script for text field (function () { // Initialize counter var sum = 0; // Loop through the fields // and increment the counter for each Yes value for (var i = 1; i < 15; i += 1) { if (getField("Question " + i).value === "Yes") { sum += 1; } } // Set the value of this field to the sum event.value = sum; })();
Do the same for other areas, but change the 'yes' in the code above to the appropriate string, either 'No' or 'Unknown'.
It would make sense to convert this to a function in a script at the level of the document, something like:
// Document-level function var radioButtonValueCount = function (sVal) { // Initialize counter var sum = 0; // Loop through the fields // and increment the counter for each sVal value for (var i = 1; i < 15; i += 1) { if (getField("Question " + i).value === sVal) { sum += 1; } } // Set the value of the field that called this function to the sum event.value = sum; }
You would then call it like that in the case of calculating a text field that counts the number of selections of Yes:
// Set this field to the number of Yes selections radioButtonValueCount("Yes");
Do the same for Dummies and unknown fields.
Tags: Acrobat
Similar Questions
-
How uncheck you the option buttons in Adobe Acrobat Pro XI?
How uncheck you the option buttons in Adobe Acrobat Pro XI?
OK, so I have a three sets of radio buttons each three choices, so, basically, it looks like this
Cheques: ( ) ( ) ( )
Deposit slips: () ())
Envelopes: ( ) ( ) ( )
In case anyone is confused, () are radio buttons. Basically, I want radio buttons to act as check boxes, I want to be able to click them and outside. I don't want us boxes because I want them to be circles and not square. Is there a way to do this? Maybe using javascript, what code would be?
Radio button names: QTY.
XQTY
XPrice
Thanks in advance guys
You don't have to use a script. I rarely use the option button because they cannot normally be deselected once in the Group has been selected, but here's a backdoor method I use in the mouse event to the top:
Uncheck the box if the SHIFT key is pressed while clicking on
If (event.shift) event.target.value = "Off";
The user will know that it is available. You can also configure a button that resets the value of the button to "Off".
Another option is to add another choice, as "not applicable".
-
change the size of the option button
How to change the size of the option button?
Thank you!
I hope that there is no option to change the size of the radio button. If you want to change it, you can use the images and apply CSS
RadioButton {}
Width: 40;
height: 40;
fontSize: 18;
fontFamily: myMyriad;
color: #FFFFFF;
textRollOverColor: #FFFFFF;
("selectedUpIcon: Embed("/images/radio_on.png ");
("selectedOverIcon: Embed("/images/radio_on.png ");
("selectedDownIcon: Embed("/images/radio_off.png ");
("upIcon: Embed("/images/radio_off.png ");
("overIcon: Embed("/images/radio_off.png ");
("downIcon: Embed("/images/radio_on.png ");
}Thank you
Surendra. -
Good morning friends,
So for my work, I need a script to open files with the same name but located in a different folder. But since I'm a total noob when it comes to programming, I can't understand how do. That's what I have in mind:
-J' I manually open an image.
-The script will look for a file with the same name in another folder that I've specified.
-The script will then select the channel CMYK of the second file and copy and paste it into the first file.
-The second file is then closed without saving the changes.
I have problems with the part where the script searches for a file with the same name as the opened file. I would really appreciate help. Thanks in advance.
If (app.documents.length > 0) {}
myDocument var = app.activeDocument;
var Nomdoc = myDocument.name;
try {var basename = docName.match (/(.*)-.)} [ ^\.] +$/)[1]}
catch (e) {var basename = thedoc.name};
var path = / * path of folder to insert as a string here * / + ' / ' + base name + / * insert file extension, including the period as a string here * /;
If (queue (path) .exists == true) {var otherDocument = app.open (File (path))};
};
-
How can I stop the page to reload automatically when I hit the back button?
A few months back, I upgraded to a new laptop, and since then, when I hit the back button, it refreshes the previous page from what I can understand. On my last laptop, if I was doing some research on a site and click the previous button, the search bar would be automatically ready to hit the BACKSPACE and delete what is there for a new search. Now, when I hit the back button, I have to manually click inside the search box to do, and I hate it. When you are doing research on multiple sites, like this time savers really help. This applies to regular sites (forums, online stores, etc.), not search like Google sites.
I don't have this problem on my old laptop and does not know how to solve this problem on this one. They are the two Win7 x 64, and version of the browser is not the issue. I started Firefox on this computer that same exact on the last of them, and after the updates, it's always the same. I am currently on 8.0 but will soon be upgrading to the new.
Do you mean that the search bar on this page focus?
Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).
- Makes no changes on the start safe mode window.
- https://support.Mozilla.org/KB/safe+mode
-
Position of the option button for the answer is not in proper alignment.
How can I get the option box and the response to align option? (See below). I don't know what happened to get that way. I tried to change the width, the police, the type of police, has replaced the slide, etc. and have not been able to solve. Regardless of the type of question, true-false, multiple choice, multiple selection, it is always like that. Thanks in advance for your help.
Don ghinis
LMS administrator / instructional designer.
Check your preferences to see if you have enabled Autosize captions. If so, turn it off and create a new question.
-
Prefill a text box from a selection of the option button
Hi people,
I just noticed an error in one of my first attempts at Javascript - luckily I don't think that one of my colleagues have noticed yet, but I need to fix it as soon as possible!
I have two radio buttons naned "Radio Button13". One is for when the person is full time and one for when they are part-time. When the full time button is selected, I get text (that I placed in the value of the button) to fill out in advance a text box below. The text is something like "38 hours per week. Part-time has nothing.
In the Mouse Up script for full-time, I placed:
If (this.getField("Yes").value is "1")
= this.getField("Working_Hours").value ' 08:30 to 17:00 Monday to Friday " < < < this text is same not the same as the value of the button so I don't know why I put that here, this is not what I want in the text box.
The text of the button value is reflected in the area of text (called "working time") very well, but the idea is that when part-time work is selected, the user is able to enter the hours in the area. You can type, but as soon as you leave the text box, the text disappears.
Where am I wrong? How can I solve this problem?
It is not wrong, but it answers my question. If you keep things put in place what they are now, you can use the following custom calculate script:
(function () {}
Get a reference to the Group of radio buttons
and its value
var f = getField ("Radio Button13");
v var = f.valueAsString;
Allow the user to enter text
Event.Target.ReadOnly = false;
Located only value in this field if a change in the option box
is what triggered this script
If (event.source & event.source = f) {}
Si (v ! == « Off » && v ! == "«) {}
Event.Target.ReadOnly = true;
Event.Value = v;
} else {}
Event.Value = "";
}
}
})();
-
Pulling data from a selection of the option button to use in the field
I have a radio with 9 options button (1 000, 2 000, 3 000... 9 000). It's a form of insurance, and I can't change to a drop down or fill-in, etc.. I need a later field in the form to the number they chose in the option box. For example, if some select 3rd in the series of radio (3,000) button I want Field2 fill-in auto number 3 000.
Is it possible to do an if / then statement to extract data from the radio button option? I could do this in Excel but don't have a clue how to do here. And I don't know about Java. :-(
Any help would be appreciated!
Carol
You can try this custom script that another user here suggested to me
You click on properties > Calculate > custom calculation Script > change
Then paste this in...
var v = this.getField("Name_of_Radio_button_grouping").value;
If (v == "1000") event.value = "1000";
else if (v == "2000") event.value = "2000";
else if (v == "3000") event.value = "3000";
else if (v == "4000") event.value = "4000";
else if (v == "5000") event.value = "5000";
else if (v == "6000") event.value = "6000";
else if (v == "7000") event.value = "7000".
else if (v == "8000") event.value = "8000".
else if (v == "9000") event.value = "9000".
etc.
else event.value = "";
-
Check if the option button is selected
I am trying to create a quiz in an e-learning module. There are some multiple choice questions with answers displayed next to the radio button. When the appropriate radio button is selected, I want an item to appear on the screen. I tried different codes to check whether a radio button is selected but no luck so far. This is my latest code:
SYM. $('Texte1') .html (' < form >, < input type = "radio" name = 'sex' id = 'man' value "male" = > male < br > < br > < input type = "radio" name = id "sex" = value "woman" "female" = > female < /form > ');
If ($(' #man:checked').val() == 'true') {}
SYM.$('Ellipse'). Show();
}
Demo file: https://www.box.com/s/dyu8emyh385taydkdaos
I used the includeMergeSourceInfo function.
var genderForm = '
';SYM.$("input").html (genderForm);
$(' input [nom = «sexe»]') .change (function() {}
var genderChoice = this.value;
SYM. $("output") .html ("you selected:" + genderChoice + ".");
});
-
Can't seem to load correct calculation on the option button
Hi all
Its a long time since I cut all code and need help with this question that I hope will help me other fields I'm calculating.
So I use Acrobat X Pro, I'm new on so I have two radio buttons with the same name auth, but the choice of Yes and no; the Yes option button is the default.
I have a read only area I want to maintain the value based on simple logic, if yes is clicked, then set a value of 350 set the value to 0
I walked into the Javascript code within the custom calculation script
var Field1 = this.getField("auth").value;
If (field1 = "Yes") {event.value = "350";
} else event.value = "0";
When I test this the calculated field is STILL 350 regardless of the selected option button...
someone tell me why? or especially how to fix it.
Thank you
George
You have made the classic mistake of using the assignment operator 'is', where
You should use the 'is' operator comparison in the if statement.
-
Display the option button if the number of rows in the table is equal to 1
I'm having issues there buy maybe a simple script out there.
I have a table which can have up to four lines. If the table contains only one row, an option button can be clicked to change the format/entry of cells in this row. I have to hide this box of a user option, if they added more of a line to the table and make it available again if they reduce the number of lines to one.
I have everything else works well (radio buttons change line format, add/delete rows in the table using buttons, number of rows in the first column)
Anyone have any ideas?
See you soon
Bobby
You can place it in the code that adds more lines when running... If you have questions send the fomr to [email protected] so I can check it out...
Thank you
Srini
-
Conditionaly without refresh report view, when I select the option button
Hello
I have 5 option in an option button. I created 5 parts of report.
I want to display region report, when I select any radio button then corressponding region report should be display. This shoude be without page refreshes.
How can I do this...
Thank you
Ed
Published by: Ed on November 3, 2010 06:16Kaushik, can you check one of the attributes of the region report ( region of change-> attributes-> region ID static ). It wouldn't hurt to go through the documentation before asking a question, especially when someone (Jari) had bothered you post the direct link for the answer.
Another thing, have you even read the steps I posted earlier (on the changes that I made this page in your workspace), why don't you try the same in the apex 3.2 and see if it works? After all, you can see all the code that is there since its your workspace.
-
cfdiv refreshes liaison to the option buttons
Hello
Simple enough question that I can't find much information on Google (one report of it on a work around for a cfgrid controls and not a cfdiv).
I have a cfdiv, which is tied to a cfselect and two boxes of ala:
< cfdiv bind = "url: annex - snippet.cfm?" ' selectAll = {selectAll} & orderBy = {orderBy} & startDate = {startDa you} "id ="plan">
selectAll and orderBy are two option buttons, which each has two States. startDate is a cfselect.
The problem is that the cfdiv don't not auto-refresh based on any button of the radio I go second - for example, in the above example, it will refresh the option selectAll button-based, but not the orderBy option button. If I link it in this way:
< cfdiv bind = "url: annex - snippet.cfm?" ' orderBy = {orderBy} & selectAll {selectAll} = & startDate = {startDa you} "id ="plan">
Then, it will refresh of orderBy, but not the selectAll.
Even more interesting is that, if I put the cfselect (startDate) AFTER the second box option in link it the list (see above) then it will not update from this, either. Just sort of "stop" refreshing once you put in a button value. radio with what whatever after this value in the list.
Any ideas?
Thank you
SamHere's the js function which may help you:
assuming that your cfdiv now looks like this:
<>
bind = "url: annex - snippet.cfm?" startDate
{startDate} = & selectAll {selectAll} = & orderBy = {orderBy}"id ="plan">Add this to each option button in the Group orderBy:
onClick = "refreshDiv (this.value); »
and add this js function to the HEAD of your page:
[script]
refreshDiv = {function (orderby)}
StartDate = return var [0].startDate.value;
var selectallgroup = return [0] .selectAll;
for (var j = 0; j)<=selectallgroup.length; j++)="">=selectallgroup.length;>
If (selectallgroup [j] .checked) {}
SelectAll var is selectallgroup [j] .value;.
}
}
ColdFusion.navigate (' Annex - snippet.cfm? ") startDate
= "+ startdate + & selectAll =" + selectall + & orderBy ='+ orderby "plan");
}
/ [script](Note: the function assumes that an option button in the selectAll group)
is always verified)HTH
Azadi Saryev
SABAI - Dee.com
http://www.SABAI-Dee.com/ -
Could you please split the 'Options' button in two?
Used to have a single button at the top of the e-mail message to show the remote content - of Thunderbird, but now there is an Options button with this choice as well as four more. Because so many messages force me to show the remote content, need me two clicks to continue with the message. Quite boring. If this button should be divided into a button 'Show remote content' and a button 'Other Options', things would return to the previous level of convenience. (I know I might opt for remote content automatically, but I like that another security measure). TIA!
I agree with you.
This has been reported as a bug.You can add your vote for this change.
You vote by clicking on the link to Vote - at the top where it says:
Importance:-normal with 4 votes (vote)
You will need to register and sign in to vote. -
Cannot use the option button to access the folder of bookmarks hidden on a dead drive
I'm on Mac OSX 10.7.5, and I can easily access the folder on my current drive by pressing the option key (so that the hidden library appears) then get bookmarks of otherwise hidden files (since it's my new boot drive)
BUT
I need to copy / move my LAST favorites since ten days previously, a dead hard drive. The drive is usable, just not able to start.
BUT
Since this amazing new 'hold option on GO in the Finder menu to see the invisible library feature' (sarcasm) requires your operating system to be started, I can't access the bookmarks folder in the library. How can I do this if the Finder is not started on the dying drive? Is - this make any sense?
Check this?
COR - el said
Try:
Maybe you are looking for
-
Safari will not connect a secure website
Impossible to connect to the Web site of the lumo energy checking everything reset safari and used to help - made everything I how do anyone have clues
-
Quark has stopped working after upgrading operating system
Downloaded 10.11.2 El Capitan and now my Quark Express friggin crashes (Ver 10.1.0.1) advice? Thank you Tony
-
Lenovo U31-70 double tap on the touchpad does not work
Hello I just bought a new Lenovo U31-70 with Windows 10 already installed on it. There is a problem with the double tap feature, it does not work. The feature is enabled in the option. This model of Lenovo has Alps touchpad driver and I am not able t
-
BACK of 8/8.1 64 bit Windows program
Good afternoon I work for a COMPUTER service for a courier company that we undertook the process of updating our systems to windows 7/8/8.1, but unfortunately we have the program that is 16 bit. There is no way for us to not use this program and the
-
First timer, non-techie, "installed" iTunes on my laptop HP 64-bit Windows, a few things work like 'radio', but cannot open iTunes store and cannot finish syncing my iPhone it and freezes usually when I click too much. The installation is wrong (eve