Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

How can I assign multiple values using a radio button?

March 18 (10 years ago)


I'm modifying the GURPS sheet by Muton to better handle ranged combat. What I'm trying to do is allow the user to pick which ammo to use using a radio button. However, only one value can be assigned at once. How can I go about assigning all four attributes to the "in use" attributes?
March 18 (10 years ago)
Finderski
Sheet Author
Compendium Curator
You can't. Radio buttons are a one option only sort of thing. Could you use checkboxes?
March 18 (10 years ago)

G V. said:

You can't. Radio buttons are a one option only sort of thing. Could you use checkboxes?

Well, no. They also just do one value at a time, and I need the user to only load one kind of ammo. I know an array is possible, but I don't know how it could be parsed without using javascript.
March 18 (10 years ago)
Finderski
Sheet Author
Compendium Curator
Can you give an idea of what you're trying to accomplish? I'm guessing you want this to be used as part of roll formula. Could you put a roll button next to each row? Then you would only need to reference the single weapon row which seems like it might be easier. It does mean multiple roll buttons instead but would make it easier in that regard. Does that make sense?
March 18 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter

As I understand it, he wants to be able to use for example @{ammo}, @{type}, @{ammo-divisor}, and @{special} in macros/roll buttons, and have those values pull from the row selected by the radio button.

Unfortunately, Helmic, the way the attributes system and radio buttons work, that's just not possible. (Assuming my interpretation of your desire is correct.)

March 18 (10 years ago)
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator

Brian said:

As I understand it, he wants to be able to use for example @{ammo}, @{type}, @{ammo-divisor}, and @{special} in macros/roll buttons, and have those values pull from the row selected by the radio button.

Unfortunately, Helmic, the way the attributes system and radio buttons work, that's just not possible. (Assuming my interpretation of your desire is correct.)


You could feed it all into a roll template. Have the value of the radio button be value="{{ammo=@{ammo1}}} {{type=@{ammotype1}}} {{divisor=@{ammo-divisor1}}}...etc"
And then for the button roll call your roll template and feed it the radio's value which would feed the roll template all of that row's data.
March 18 (10 years ago)

Steve K. said:

Brian said:

As I understand it, he wants to be able to use for example @{ammo}, @{type}, @{ammo-divisor}, and @{special} in macros/roll buttons, and have those values pull from the row selected by the radio button.

Unfortunately, Helmic, the way the attributes system and radio buttons work, that's just not possible. (Assuming my interpretation of your desire is correct.)


You could feed it all into a roll template. Have the value of the radio button be value="{{ammo=@{ammo1}}} {{type=@{ammotype1}}} {{divisor=@{ammo-divisor1}}}...etc"
And then for the button roll call your roll template and feed it the radio's value which would feed the roll template all of that row's data.

That's actually pretty clever. This does what I want, though I worry about how I'm going to feed this into API scripts.
March 20 (10 years ago)

Edited March 20 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

Steve K. said:

You could feed it all into a roll template. Have the value of the radio button be value="{{ammo=@{ammo1}}} {{type=@{ammotype1}}} {{divisor=@{ammo-divisor1}}}...etc"
And then for the button roll call your roll template and feed it the radio's value which would feed the roll template all of that row's data.
Oooh, that may just help me get the text value from a select. I'll have to try later!

EDIT: Nevermind. It doesn't allow another input to read the value while the roller reads the text. :(
March 20 (10 years ago)
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Mark, if it's all going into a roll template you could replicate the text as a roll table element.

<select name="attr_test" />
<option value="{{value1=1}} {{value2=2}} {{text=Test Select}}" checked="checked">Test Select</option>
March 20 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter

Steve K. said:

Mark, if it's all going into a roll template you could replicate the text as a roll table element.
It's not, another input is using the value. :(