Copy link to clipboard
Copied
Hi
I have 5 check Boxes named as Check Box1, Check Box2, Check Box3, Check Box4, Check Box5
& a TextField named as Score. I want when I check (Check Box1) a Value 5 appear in Score textfield.
& when i check Check Box2 value 10 appears in Score text field & so on.
Any help?
Thanks & Regards
Junaid Khalid
Copy link to clipboard
Copied
If you are gonna check only 1 you can use this code:
if(this.getField("Check Box1").valueAsString != "Off")
event.value = "5";
else if(this.getField("Check Box2").valueAsString != "Off")
event.value = "10";
else if(this.getField("Check Box3").valueAsString != "Off")
event.value = "15";
else if(this.getField("Check Box4").valueAsString != "Off")
event.value = "20";
else if(this.getField("Check Box5").valueAsString != "Off")
event.value = "25";
else event.value = "";
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Every checkbox is worth 5?
If so then you can use this script as "Custom calculation script" of "Score" field:
var total = 0;
for ( var i=1; i<=5; i++){
if(this.getField("Check Box"+i).valueAsString != "Off")total++;}
if(total == 0)
event.value = "";
else
event.value = total*5;
Copy link to clipboard
Copied
Thank You for reply
Check Box1 value is 5 Check Box2 Value is 10 Check Box 3 Value is 15, Check box export value is Yes, above mentioned code is not working in my form.
Thanks
Copy link to clipboard
Copied
I assumed you wanted to total checkboxes value in score field so disregard code above.
What happen if two or more of checkboxes are checked?
Copy link to clipboard
Copied
I will only check 1 Check Box at a time
or if you sugest then i will choose radio button option.
Copy link to clipboard
Copied
If you are gonna check only 1 you can use this code:
if(this.getField("Check Box1").valueAsString != "Off")
event.value = "5";
else if(this.getField("Check Box2").valueAsString != "Off")
event.value = "10";
else if(this.getField("Check Box3").valueAsString != "Off")
event.value = "15";
else if(this.getField("Check Box4").valueAsString != "Off")
event.value = "20";
else if(this.getField("Check Box5").valueAsString != "Off")
event.value = "25";
else event.value = "";
Copy link to clipboard
Copied
Sorry Ms. Neha still script is not working can i share my remote access with you?
Copy link to clipboard
Copied
What exactly isn't working?
You can upload your file to site like google drive or similar and post link here.
Copy link to clipboard
Copied
https://drive.google.com/file/d/1ud6bRkn4iOk7wgffYZ9tRSCFRJ2uZlcy/view?usp=sharing
file uploaded to google drive.
When i place above script in Score Text field nothing happened.
Copy link to clipboard
Copied
You need to allow access in google drive, right click on your file and select get link and change it to anyone with the link.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank You Sooooooooooooooooooooooooo Much Ms. Nesa, I found my mistake i was putting that script in validation instead of custom calculation. You are very genious Ms. I am very gratefull to you. Sorry I wasted a lot of time. It's working like a charm. Sorry Again You are very kind & i hope in future you will again help me.
Thanks A Lot............
Copy link to clipboard
Copied
Can you please modify this script for Radio Button? I am using Radio Button (Group 1) Export value (Choice1) I tried in many ways by changing values in Export values or tried to change some values is in Javascript code but did not get any solution.
Thanks in advance....
Copy link to clipboard
Copied
Use like this:
if(this.getField("Group1").valueAsString == "Choice1")
event.value = "5";
Copy link to clipboard
Copied
I want to check only one checked box, if any checkbox checked other automatically unchecked. How can I do this?
Copy link to clipboard
Copied
Give them same name, for example name all of them "Check" and give them different export values in checkbox properties under 'options' tab.
Copy link to clipboard
Copied
When checked CheckBox1 text field get value 10, checked CheckBox2 text field get value 25, checked CheckBox3 text filed get 35, Checked CheckBox4 text filed get value 60, Checked CheckBox5 text filed get value 95,
Only checked one Checkbox, if try to Check multiple Checkbox, Previous checkbox automatically Unchecked,
Only one checkbox value pass in Text Field,
My PDF link hare: https://drive.google.com/file/d/1gEAe3u5L5e3ITK-s1oCtFmULve5SdTTY/view?usp=sharing
How can I do this? Please help me.
Copy link to clipboard
Copied
Use check boxes with the same name and different export values.
Copy link to clipboard
Copied
Bro i have very little knowledge in Javascript and adobe fields my export value of check box is Yes, what value should be there according to script?
Copy link to clipboard
Copied
Did you put script in calculation or validation?
You can also do what Bernd said and name all 5 checkboxes to "Check Box" and give each different export value (5,10,15...etc) and then as custom calculation script of Score field use this:
if(this.getField("Check Box").value != "Off")
event.value = this.getField("Check Box").value;
else event.value = "";
Copy link to clipboard
Copied
I am putting script in Validation, When i rename all check boxes to Check Box then when I tick 1st check box all other check boxes checked automatically.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you very much to give your valuable time, It's work.
Copy link to clipboard
Copied
You can use the export values 5, 10, 15, ...
Copy link to clipboard
Copied
Hi Nesa,
We´re trying total checkboxes value in score field but still not working. Any help?
we used:
if(this.getField("box1").value != "Off")
event.value = this.getField("box1").value;
else event.value = "";