How to ? Checkboxes to fill Textbox in a specific way
Hello hello everyone,
(First of all, I'm truly sorry for my poor english and thus, for this question badly written, I'm not an english speaker)
(Second, I already tried to find an answer by searching through the forums but I didn't find anything that was of any help with my pretty poor abilities to understand Javascript (and I already asked my question in the french version, which didn't give any result))
Here is the issue I'm facing :
A series of checkboxes whose number associated (I suppose the value?) must be transferred in a text area when checked. Problem “bis”, I don’t understand javascript and the many examples I’ve found on the forum about similar issues, hence I can’t ‘translate” them to my particular situation.
More precise description:
I have a series of checkboxes (in an interactive PDF form that I make with ADOBE ACROBAT PRO), each one represents a certain number "1", "2", "2024", etc. => in fact a code in a list of work risks. The risk "Fall" has the code "1", the "chemical exposure" risk has the risk code "2015", the "screw drilling" risk "14554", etc. etc.
There are about fifteen boxes, each one linked to a risk, therefore to a code.
People can tick these boxes, to say what risks they are exposed to, but I also would like, and this is my concern, to ensure that once the boxes are ticked, the numerical code associated with them is returned in a text box (e.g. Text1), one after the other, in the form of "code#1, code#2, code#3, etc. ». (So comma+space "code" comma+space "code", etc.)
I know how to create boxes / text field. What I can't do is create the javascript script that makes sure that if I check one box, it goes into the text, that if I check two, no matter which ones, their associated codes go into the text box following each other, and that if I uncheck one check, then its associated code disappears from the text box, without making the data in the other checked boxes disappear.
Intial situation :
Nothing is checkeck ( o ) => Nothing in the textbox
- Risk 1 Code 1 o
- Risk 2 Code 2 o
- Risk 3 Code 254 o
- Risk 4 Code 7568 o
Texte :
Situation 1 :
3 boxes are checked (X) => The textbox is automatically field with the code associated to the boxes
- Risk 1 Code 1 o
- Risk 2 Code 2 x
- Risk 3 Code 254 x
- Risk 4 Code 7568 x
2, 254, 7568 |
Te
Sixte :
Situation 1 (bis) :
2 boxes are checked, one was 'un'checked => The textbox automaticaly adapt itself
- Risk 1 Code 1 o
- Risk 2 Code 2 x
- Risk 3 Code 254 o
- Risk 4 Code 7568 x
2, 7568 |
Te
Thank you very much for reading so far.
Olivier
