changing btn names at the stack level?
rjb at robelko.com
Wed Mar 29 17:20:46 EST 2006
>I have a 15 card stack with 31 buttons per page (15 yes, 15 no, 1 Go
>next card). When I made this stack I screw up and did not name the
>buttons when copy& pasting them. I want the YES label buttons to be
>named "1" and the NO label buttons named "0". Can I do this with a
>script, preferably at the stack level?
Ben, sounds like you have a stack that asks some questions that users
respond with yes/no answers and go to next page.
I presume that each yes/no pair is a group of radio buttons. Then,
there is no need to have different labels and button names. Just have
empty label and set name to yes and no, respectively.
In order to distinguish which question each pair of buttons belongs,
you can name each group q01, q02, ... q15. This will make handling
operation and results easily.
For example, to find the answer to question 5, you use
get the selectedButtonName of grp "q5" --> gives yes or no
To fetch all responses in batch
repeat with i=1 to 15
put the selectedButtonName of grp ("q" & i) into line i of userAnswers
if you want to change yes/no to 1/0 for calculations, you can
replace "yes" with "1" in userAnswers
replace "no" with "0" in userAnswers
I realize that the above probably match your situation but it should
give you ideas how to approach things.
Finally, instead of having multiple cards each with 15 questions, you
can try doing all on a single card. The trick is to have questions in
a custom property or a hidden field and use the "go" button to
replace what users sees instead of physically going to another card.
More information about the Use-livecode