Re: Add value of radio buttons to variable
Posted: Tue Oct 23, 2018 4:41 pm
It seems to be working as expected with the above script in the evaluate button, but only IF the radio buttons have been checked. If a group doesn't have a hilitedbutton, then it will throw an error. I think to fix this, you will need to check that there is indeed a hilited button in each group. I'm not sure of the best way to do this, as I rarely use radio buttons myself. If you want, I can upload your stack here for others to look at.
EDIT: I think I've got it:
EDIT: I think I've got it:
Code: Select all
global VPname, neuroscore
on mouseup
put 0 into neuroscore
repeat with x = 1 to 3
if the hilitedbuttonname of grp ("radiogrp" & x) is empty then
answer "Please complete survey"
exit mouseup
end if
add the label of btn (the hilitedbutton of grp ("radiogrp" & x)) of grp ("radiogrp" & x) to neuroscore
end repeat
put empty into VPname
put fld "name" of card "GCS" into line 1 of VPname
put label of button "Sex" of card "GCS" into line 2 of VPname
if fld "name" is not empty and label of button "Sex" is not "choose sex" then
go next card
else
answer "Fill in all fields"
end if
end mouseup