Expand my Community achievements bar.

Adding radio buttons

Avatar

Level 3

Good Morning -

I'm creating a form with several radio buttons that each have their own value.  When they are clicked on, I want a numeric field at the bottom of the form to add the values for a total "score".

I've done this on another form and it works like a charm.  I cannot seem to get it to work the same on this form and it's driving me crazy!

I keep getting the following error....1.jpg

All the fields are defined as they should be.

2.jpg

Any ideas for me?

6 Replies

Avatar

Level 8

Sounds to me like your radio buttons are probably in a subform making the object where your script is located out of scope. Make sure you reference your radio buttons with the subform they are wrapped in as well.

A good tool is to click on the object you're referencing while holding the CTRL key down. Just make sure you see the flashing cursor in your script editor before doing that.

Kyle

Avatar

Level 10

You can't access the values of the individual buttons themselves (as far as I know). You have to take the value of the radio button group.

Avatar

Level 3

Thanks for the replies.  I figured out what was going on soon after I posted this yesterday, but couldn't figure out how to take the question down off the board.

I was using a box to line up all the fields nice and neat, and it was causing troubles.  I removed the box and everything works great now.  Thanks again.

Avatar

Level 2

I'm trying to do something similar but don't know how to go about adding the nummbers for a total score.  Here's what my screen looks like.  However I'm wondering if I need to put just the numbers in a radio button group and the text in regular text fields because when I looked at the properties it's all mixed up.

radio buttons.JPG

Avatar

Level 3

If you are using a radio button, you should be able to specify the value of each one under the binding tab.  You should be able to put the text under the Item part.

So you would put in 1 as the value and then 1 - Everyday (or however you want it to look) under the Item.

Then for the total, you can add the value of each radio group.  I just used radio1+radio2+radio3, etc...  If one is not filled in, then it won't add it in.  If you want to just show what the value is in the example above, then you would just put the name of the radio button and it should display the value.  I am using FormCalc for the calculations.

Let me know if this doesn't help and I'll try to help more.

Gretchen

help.jpg

Avatar

Level 2

I appreciate your help, I didn't even noticed that I had like that already.  However, I did have problems with the calculation.  I had 3 seperate questions with a total of 16 different radio options

so like question 1 had 4 options, question 2 had 6 options and question 3 had another 6 I tried doing the sum(rb11+rb2, etc.) but I got an error message stating it didn't know what RB1 was.  Then I realized that I had the radio buttons stored in a group.  Therefore to get it work I had to use, sum(GP1, GP2, GP3) and I got my total score.