Hello I'm using a form with multiple checkboxes. The checkboxes work fine when applying rawValue.
The issue I'm having is when a checkbox is unchecked.
This happens when my client makes an error by clicking the wrong checkbox.
As they uncheck the box my all the text box information is removed and the client must hit the reset button.
How can I add the following functions?:
Here are my settings:
topmostSubform.#pageSet[0].PageArea1.#subform[0].CheckBox6::change - (JavaScript, client)
if (this.rawValue == "A1"){
TextField7.rawValue = "• Avoid animal exposure; remove carpet, and clean bedding often" + "\n" + TextField7.rawValue;
}
if (this.rawValue == "0"){
TextField7.rawValue = "";
}
if (this.rawValue == "A1"){
topmostSubform.Page1.Trig.RowTrig.Triggers.rawValue = "Animal dander/Dust/Mold/Cockroach" + "\n" + topmostSubform.Page1.Trig.RowTrig.Triggers.rawValue;
}
if (this.rawValue == "0"){
topmostSubform.Page1.Trig.RowTrig.Triggers.rawValue = "";
}
if (this.rawValue == "A1"){
topmostSubform.Page1.Trig.RowTrig.Avoid.rawValue = "• Avoid animal exposure; remove carpet, and clean bedding often" + "\n" + topmostSubform.Page1.Trig.RowTrig.Avoid.rawValue;
}
if (this.rawValue == "0"){
topmostSubform.Page1.Trig.RowTrig.Avoid.rawValue = "";
}
Thank You,
Arnold
Solved! Go to Solution.
Views
Replies
Total Likes
Why don't you make simply some if sentences which involve all possibilities?
Then you can put the script on each "change" event of the checkboxes.
(Is some work but I think less than you already invested.)
Another solution would be to write some script on the calculate event of your Textbox. Though the user won't be able to overwrite it then.
(Javascript)
if (A.rawValue != null)
{this.rawValue = "Text1 ";}
if (A.rawValue == null && B.rawValue != null)
{this.rawValue = "Text2 ";}
if (A.rawValue != null && B.rawValue != null)
{this.rawValue = this.rawValue + "Text2 ";}
if (C.rawValue != null && (A.rawValue != null || B.rawValue != null))
{this.rawValue = this.rawValue + "Text3 ";}
if (C.rawValue != null && A.rawValue == null && B.rawValue == null)
{this.rawValue = "Text3 ";}
if (A.rawValue == null && B.rawValue == null && C.rawValue == null)
{this.rawValue = null;}
if (A.rawValue != null || B.rawValue != null || C.rawValue != null)
{None.rawValue = null}
You can also put this onto the change event of your checkboxes, you just have to change the "this" into the name of your Textbox...
Hope I got the names at least a bit right
The descriptions in the Textbox will be sorted though.
Lisa
Edit: looked at your script once again. The field you script out has some "#" in it's name. If the fields you script to have them in their names too and you just delted it it won't work. Neither will they work if you simply leave them out.
If they have the only solution is to rename the subforms etc.
Views
Replies
Total Likes
So if I understand yo correctly each checkbox will add a line to the a field. More than one checkbox updates the field. If I uncheck a box ...all text in the fields is removed and that is the issue ...right?
Paul
If I'm reading your description correctly you want:
1. Unchecking a mistakenly checked box: remove the text that was added to the textbox
2. Checking a Box other than the Clear box: remove the Clear box check.
Here is some psuedo-code since I don't have all of your variables available:
Assumptions:
Your Checkbox value property are set to the text you want to add to the text box.
2. Basically you want to check to see if the rawValue of the checked box is NOT the clear box. So if it isn't, we change the checkbox named clearBox's checked value to false (therefore removing the checkbox)
if(this.rawValue != "0"){
clearBox.checked = false;
}
1. This will be more of explaining: if the checkbox is unselected, you need to check it's checked property, and if it is false, you should remove the text added to the textbox. If text from all of the checkboxes are being added to the same box, you will need to do some string manipulation to parse out the text that was mistakenly added.
As a side note, you have a bunch of extra if statements in your code:if (this.rawValue == "0"){} and if(this.rawValue == "A1"){}
Since you are just changing values to empty strings each time, you can clean up your code by lumping it all together:
if(this.rawValue == "0"){
TextField7.rawValue = "";
topmostSubform.Page1.Trig.RowTrig.Triggers.rawValue = "";
topmostSubform.Page1.Trig.RowTrig.Avoid.rawValue = "";
}
else if(this.rawValue == "A1"){
TextField7.rawValue = "• Avoid animal exposure; remove carpet, and clean bedding often" + "\n" + TextField7.rawValue;
topmostSubform.Page1.Trig.RowTrig.Triggers.rawValue = "Animal dander/Dust/Mold/Cockroach" + "\n" + topmostSubform.Page1.Trig.RowTrig.Triggers.rawValue;
topmostSubform.Page1.Trig.RowTrig.Avoid.rawValue = "• Avoid animal exposure; remove carpet, and clean bedding often" + "\n" + topmostSubform.Page1.Trig.RowTrig.Avoid.rawValue;
}
if they can only select either "0" or "A1", then change the (else if) to just an (else) with no logic in parenthesis. else{ ... }
Let me know if you need help with part 1, or if my assumption of what you are asking is incorrect.
Thank you,
Alex
I've tried many variations looking at this post and others and I'm unable to do what I need to do. I'm sure I'm making an obvious mistake, but cannot see it. I'm using LiveCycle and if a checkbox is checked then one of 3 checkboxes below must be checked. Here's my code:
var BoxCount = A.rawValue + B.rawValue + C.rawValue
if (New.rawValue == 1)
{if (BoxCount = 0)
alert ('You must select at least one location');
}
Any ideas?
Thanks!
Views
Replies
Total Likes
Make sure you have == and maybe the alert will hit, and add a ; at the end of the statement
Views
Replies
Total Likes
thanks. now it is telling me "A" is not defined.
Views
Replies
Total Likes
are you referencing the A checkbox by name or id? You may need to actually type it all out:
form.subform.checkBoxes.A (or something like that)
Views
Replies
Total Likes
There is a concept of context that your script is running (like a file location in a directory). If you are in the same directory you can simple call the filename. If the file is in another drectory you must put a path infront of the filename. The easiest way to deal with this is to put your cursor in the text editor at the beginning of the A.rawValue reference. Now hold down the Ctrl key and move the cursor to the field that you want to reference (on the drawing palette). The mouse shoudl change to a V. Click the mouse and th erelatove expression will appear in the script editor where you put the cursor.
Also in your script you have syntax errors:
var BoxCount = A.rawValue + B.rawValue + C.rawValue
if (New.rawValue == 1){
if (BoxCount == 0) {
app.alert ('You must select at least one location');
}
}
I have highlighted the errors in red.
Hope that helps
Paul
Views
Replies
Total Likes
Thank you. I am still getting the error message A is not defined. Any more ideas? Really appreciate everyone's help!
Views
Replies
Total Likes
Post the form so we can have a look
Paul
Views
Replies
Total Likes
Ok Users & Experts are welcome to make suggestions.
I've attached the form for a look.
Thank you all for the previous responses for this form.
Let me try to explain what is needed.
1. If check box "None" is checked......
a) All other triggers checkboxes need to be unclicked
b) The text box "Avoidance" should read "None"
2. If any of the other Trigger checkboxes are checked......
a) None should automatically be off.
b) Information about the Trigger should read in the Avoidance textbox
3. When a checkbox is unchecked.
a) Only the information related to that Trigger is removed from the Avoidance text box.
PROBLEMS I'm trying to solve...
When a Trigger checkbox is unchecked ...
a) all text information from "Avoidance" textbox should not be wiped clean.
b) Checkbox "None" is still checked.
The form is attached please feel free to check it out.
Thanks again!
Arnold L.
Views
Replies
Total Likes
Hello AKloft,
I'm trying to use some of your suggestions, I'll let you know how far I get with the results.
If you have time, you can check out my form.
Thanks Arnold.
Views
Replies
Total Likes
Why don't you make simply some if sentences which involve all possibilities?
Then you can put the script on each "change" event of the checkboxes.
(Is some work but I think less than you already invested.)
Another solution would be to write some script on the calculate event of your Textbox. Though the user won't be able to overwrite it then.
(Javascript)
if (A.rawValue != null)
{this.rawValue = "Text1 ";}
if (A.rawValue == null && B.rawValue != null)
{this.rawValue = "Text2 ";}
if (A.rawValue != null && B.rawValue != null)
{this.rawValue = this.rawValue + "Text2 ";}
if (C.rawValue != null && (A.rawValue != null || B.rawValue != null))
{this.rawValue = this.rawValue + "Text3 ";}
if (C.rawValue != null && A.rawValue == null && B.rawValue == null)
{this.rawValue = "Text3 ";}
if (A.rawValue == null && B.rawValue == null && C.rawValue == null)
{this.rawValue = null;}
if (A.rawValue != null || B.rawValue != null || C.rawValue != null)
{None.rawValue = null}
You can also put this onto the change event of your checkboxes, you just have to change the "this" into the name of your Textbox...
Hope I got the names at least a bit right
The descriptions in the Textbox will be sorted though.
Lisa
Edit: looked at your script once again. The field you script out has some "#" in it's name. If the fields you script to have them in their names too and you just delted it it won't work. Neither will they work if you simply leave them out.
If they have the only solution is to rename the subforms etc.
Views
Replies
Total Likes
Hello Forum,
I'm working on this form tonight and will try some of the solutions.
Paul Guerett,
Did you get a look at the form?
Arnold
Views
Replies
Total Likes
Your forms are queued so I cannot access them .....send them to livecyle8@gmail.com.and I will have a look but I cannot before tomorrow afternoon.
Paul
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies