Hi all,
Just updated to CSD 1.01c, which seemed to address some previous issues--thanks, Ed!
I'm having a problem with checkboxes, however. I have a text field for a base value (txtAcademicsBase), which has an associated checkbox (chkAcademics). The default for 'txtAcademicsBase' is '20', but I set up the Field Source for this field as 'AbilityValue(Academics)' which is the following function:
function AbilityValue(varAbility) {
if (chk + varAbility.checked) {
txt + varAbility + Base.Text = 16;
}
}
The idea is when you check the box, the base value switches from 20 to 16, and the plan is to handle each the other 15 abilities on the sheet the same way.
Unfortunately, I'm getting a JScript compile error. It's unspecified, but CSD seems to skip the script. Can anyone point out what's wrong with the script above, or if I might be making a different error?
Cheers,
Comments
The function you call from the field source has to return a value - that value is what is assigned to the field's text. I uploaded a super simple char sheet with an example of responding to the checkbox.
Thanks very much for the example - I see now that the function has to return a value. Very helpful!
One question: why do you need to pass the 'txtAcademicsBase' field (the 'f' parm in your function)? Could you not just pass the checkbox name? I've tried both ways and get the same result--just wondering what I'm missing.
Also, in my sheet, the 'txtAcademicsBase' field is a text box. When the sheet loads, it shows 20 (correct). When I click the checkbox, the '16' is superimposed on the '20'. So the script is working, but the display is not. Should I be using a Label field, or is there a way around this?
Thanks again!
I have a sample sheet piece for the Strength attribute. I want the Strength Value to tally up the number of Check boxes marked and return that as the Value for the Str value box. I am a complete newbie when it comes to Javascript. So I have been unable to find what I want to make that happen. I tried the code earlier in this thread however it does not seem to work I get an error also.
Have label Strength followed by 10 checkboxes labeled Str1,Str2,etc. Then I have another field labeled Str I want the Str field to tally up the 10 checkboxes so if I have 3 checked I want the Str Value returned to be 3
Edited to add attachment again
The upload was rejected because uploaded file was identified as a possible attack vector....
Edit to describe setup